summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7213080)
raw | patch | inline | side by side (parent: 7213080)
author | Björn Steinbrink <B.Steinbrink@gmx.de> | |
Sat, 18 Oct 2008 00:37:31 +0000 (02:37 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 18 Oct 2008 13:19:06 +0000 (06:19 -0700) |
read_packed_sha1 expectes its caller to free the buffer it returns, which
force_object_loose didn't do.
This leak is eventually triggered by "git gc", when it is manually invoked
or there are too many packs around, making gc totally unusable when there
are lots of unreachable objects.
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
force_object_loose didn't do.
This leak is eventually triggered by "git gc", when it is manually invoked
or there are too many packs around, making gc totally unusable when there
are lots of unreachable objects.
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index e2cb342a32f31be2b9ffc1867fbfd671fe63cef1..c78507152f5bccbba24a9daba55d2cd9942081ad 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)