summaryrefslogtreecommitdiff
path: root/src/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/object.c')
-rw-r--r--src/object.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/object.c b/src/object.c
index d3673eda0..14d64befe 100644
--- a/src/object.c
+++ b/src/object.c
@@ -156,8 +156,10 @@ int git_object_lookup_prefix(
type = odb_obj->raw.type;
- if (create_object(&object, type) < 0)
+ if (create_object(&object, type) < 0) {
+ git_odb_object_free(odb_obj);
return -1;
+ }
/* Initialize parent object */
git_oid_cpy(&object->cached.oid, &odb_obj->cached.oid);