]> git.ipfire.org Git - thirdparty/git.git/commitdiff
merge-blobs.c: fix a memleak
authorStefan Beller <sbeller@google.com>
Sat, 21 Mar 2015 00:28:03 +0000 (17:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 Mar 2015 18:12:58 +0000 (11:12 -0700)
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-blobs.c

index 57211bccb7d0a5aad8538906bcb2f4ad2900f008..7abb894c684d1ff7bc26b30ffa41597451750f20 100644 (file)
@@ -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;