summaryrefslogtreecommitdiff
path: root/merge-blobs.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2015-03-21 00:28:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-23 18:12:58 (GMT)
commitd687839c29624de4b00ac22a6d8160172b357e14 (patch)
tree0de89f8022ae130207bc8d513d1143688f221aa5 /merge-blobs.c
parentf0b1f1ece71a2bcf99e5890757ee0e41490ec7e0 (diff)
downloadgit-d687839c29624de4b00ac22a6d8160172b357e14.zip
git-d687839c29624de4b00ac22a6d8160172b357e14.tar.gz
git-d687839c29624de4b00ac22a6d8160172b357e14.tar.bz2
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 57211bc..7abb894 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;