Skip to content

Commit

Permalink
merge-blobs.c: fix a memleak
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Stefan Beller authored and Junio C Hamano committed Mar 23, 2015
1 parent f0b1f1e commit d687839
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion merge-blobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d687839

Please sign in to comment.