diff options
| author | Lambert CLARA <lambert.clara@yahoo.fr> | 2011-08-02 19:23:00 +0200 |
|---|---|---|
| committer | Lambert CLARA <lambert.clara@yahoo.fr> | 2011-08-02 19:23:00 +0200 |
| commit | 7d3ec3caac1ed10faecaf828b481b0f4958755c1 (patch) | |
| tree | c3c9674387e747bcd4401ec2c5816241ca43f87e /src/object.c | |
| parent | 80de9ae03c82b6c7f3d313edc1db72b81ad01916 (diff) | |
| download | libgit2-7d3ec3caac1ed10faecaf828b481b0f4958755c1.tar.gz | |
Fix memory leak when wrong object type is looked up from cache
Update unit test accordingly : no need to close
Diffstat (limited to 'src/object.c')
| -rw-r--r-- | src/object.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/object.c b/src/object.c index d14ca8566..8b07197f1 100644 --- a/src/object.c +++ b/src/object.c @@ -117,7 +117,10 @@ int git_object_lookup_prefix(git_object **object_out, git_repository *repo, cons object = git_cache_get(&repo->objects, id); if (object != NULL) { if (type != GIT_OBJ_ANY && type != object->type) + { + git_object_close(object); return git__throw(GIT_EINVALIDTYPE, "Failed to lookup object. The given type does not match the type on the ODB"); + } *object_out = object; return GIT_SUCCESS; |
