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

merge-blobs.c: fix a memleak

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller 2015-03-20 17:28:03 -07:00 committed by Junio C Hamano
parent f0b1f1ece7
commit d687839c29

View 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;