Return {error, enonmem} in OOM situations
This commit is contained in:
@@ -26,7 +26,7 @@ geef_oid_fmt(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
|
||||
return enif_make_badarg(env);
|
||||
|
||||
if (!enif_alloc_binary(GIT_OID_HEXSZ, &bin_out))
|
||||
return atoms.error;
|
||||
return geef_oom(env);
|
||||
|
||||
git_oid_fromraw(&id, bin.data);
|
||||
git_oid_fmt((char *)bin_out.data, &id);
|
||||
@@ -46,7 +46,7 @@ geef_oid_parse(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
|
||||
git_oid_fromstrn(&id, (const char *)bin.data, bin.size);
|
||||
|
||||
if (geef_oid_bin(&bin_out, &id) < 0)
|
||||
return atoms.error;
|
||||
return geef_oom(env);
|
||||
|
||||
return enif_make_binary(env, &bin_out);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user