diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2018-01-31 09:30:51 -0800 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2018-02-09 10:16:46 +0000 |
| commit | ef9028642ab3805b139fbfed0244e48d96af3728 (patch) | |
| tree | 7cc220d2d78cb93cc7b9717a5ec8a08ccebc3233 | |
| parent | 0fd0bfe435989b4947babfcd61b0bf573ff41e28 (diff) | |
| download | libgit2-ef9028642ab3805b139fbfed0244e48d96af3728.tar.gz | |
odb: error when we can't alloc an object
At the moment, we're swallowing the allocation failure. We need to
return the error to the caller.
| -rw-r--r-- | src/odb.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1048,8 +1048,10 @@ static int odb_read_1(git_odb_object **out, git_odb *db, const git_oid *id, } giterr_clear(); - if ((object = odb_object__alloc(id, &raw)) == NULL) + if ((object = odb_object__alloc(id, &raw)) == NULL) { + error = -1; goto out; + } *out = git_cache_store_raw(odb_cache(db), object); @@ -1175,8 +1177,10 @@ static int read_prefix_1(git_odb_object **out, git_odb *db, } } - if ((object = odb_object__alloc(&found_full_oid, &raw)) == NULL) + if ((object = odb_object__alloc(&found_full_oid, &raw)) == NULL) { + error = -1; goto out; + } *out = git_cache_store_raw(odb_cache(db), object); |
