1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-08 22:36:10 +02:00

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>
This commit is contained in:
Carlos Rica 2007-05-25 03:46:22 +02:00 committed by Junio C Hamano
parent c075aea5da
commit 0b1f113075

View File

@ -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;
}