diff --git a/sha1_file.c b/sha1_file.c
index 3fbb0820a0e01faa1d9786d5fbeb8b4d1b6e591d..70bb453be25d4e5ba05ee5f2565630a8994842f2 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
enum object_type type;
char hdr[32];
int hdrlen;
+ int ret;
if (has_loose_object(sha1))
return 0;
if (!buf)
return error("cannot read sha1_file for %s", sha1_to_hex(sha1));
hdrlen = sprintf(hdr, "%s %lu", typename(type), len) + 1;
- return write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
+ ret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
+ free(buf);
+
+ return ret;
}
int has_pack_index(const unsigned char *sha1)