summaryrefslogtreecommitdiff
path: root/merge-blobs.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2015-03-20 17:28:03 -0700
committerJunio C Hamano <gitster@pobox.com>2015-03-23 11:12:58 -0700
commitd687839c29624de4b00ac22a6d8160172b357e14 (patch)
tree0de89f8022ae130207bc8d513d1143688f221aa5 /merge-blobs.c
parentf0b1f1ece71a2bcf99e5890757ee0e41490ec7e0 (diff)
downloadgit-d687839c29624de4b00ac22a6d8160172b357e14.tar.gz
merge-blobs.c: fix a memleak
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-blobs.c')
-rw-r--r--merge-blobs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/merge-blobs.c b/merge-blobs.c
index 57211bccb7..7abb894c68 100644
--- a/merge-blobs.c
+++ b/merge-blobs.c
@@ -14,8 +14,10 @@ static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
buf = read_sha1_file(obj->object.sha1, &type, &size);
if (!buf)
return -1;
- if (type != OBJ_BLOB)
+ if (type != OBJ_BLOB) {
+ free(buf);
return -1;
+ }
f->ptr = buf;
f->size = size;
return 0;