[PATCH 06/15] merge-blobs.c: Fix a memleak
Signed-off-by: Stefan Beller <sbeller@google.com>
---
merge-blobs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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;
--
2.3.0.81.gc37f363