merge-blobs.c: fix a memleak
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Mar 20, 2015 at 17:28 UTC
d687839c29624de4b00ac22a6d8160172b357e14
1 file changed
+3
-1
merge-blobs.c
+3
-1
@@ -14,8 +14,10 @@ static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
14
buf = read_sha1_file(obj->object.sha1, &type, &size);
15
if (!buf)
16
return -1;
17
- if (type != OBJ_BLOB)
17
+ if (type != OBJ_BLOB) {
18
+ free(buf);
19
return -1;
20
+ }
21
f->ptr = buf;
22
f->size = size;
23
return 0;