upload-pack: optionally allow fetching reachable sha1
[gitweb.git] / 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;