summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorCarlos Rica <jasampler@gmail.com>2007-05-25 01:46:22 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-05-25 01:56:06 (GMT)
commit0b1f113075aafb0c91a406d984d0152e55c981da (patch)
tree0251d2b4a2dc0b035f195a7db6f634e9c371b5fd /object.c
parentc075aea5da6c35edfe86da7d3edced67cdb009c8 (diff)
downloadgit-0b1f113075aafb0c91a406d984d0152e55c981da.zip
git-0b1f113075aafb0c91a406d984d0152e55c981da.tar.gz
git-0b1f113075aafb0c91a406d984d0152e55c981da.tar.bz2
fix memory leak in parse_object when check_sha1_signature fails
When check_sha1_signature fails, program is not terminated: it prints an error message and returns NULL, so the buffer returned by read_sha1_file should be freed before. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'object.c')
-rw-r--r--object.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/object.c b/object.c
index 78a44a6..ccd7dd7 100644
--- a/object.c
+++ b/object.c
@@ -185,6 +185,7 @@ struct object *parse_object(const unsigned char *sha1)
if (buffer) {
struct object *obj;
if (check_sha1_signature(sha1, buffer, size, typename(type)) < 0) {
+ free(buffer);
error("sha1 mismatch %s\n", sha1_to_hex(sha1));
return NULL;
}