Skip to content

Commit 493fdae

Browse files
Eric Wonggitster
Eric Wong
authored andcommitted
object-file: fix leak on conversion failure
I'm not sure exactly how to trigger the leak, but it seems fairly obvious that the `content' buffer should be freed even if convert_object_file() fails. Noticed while working in this area on unrelated things. Signed-off-by: Eric Wong <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 786a3e4 commit 493fdae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

object-file.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1711,9 +1711,9 @@ static int oid_object_info_convert(struct repository *r,
17111711
ret = convert_object_file(&outbuf,
17121712
the_hash_algo, input_algo,
17131713
content, size, type, !do_die);
1714+
free(content);
17141715
if (ret == -1)
17151716
return -1;
1716-
free(content);
17171717
size = outbuf.len;
17181718
content = strbuf_detach(&outbuf, NULL);
17191719
}

0 commit comments

Comments
 (0)