summaryrefslogtreecommitdiff
path: root/object-file.c
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-06-22 04:36:48 +0000
committerJunio C Hamano <gitster@pobox.com>2024-06-24 09:07:21 -0700
commit493fdae0464282fbac99f60d94bfaabf5559c9ff (patch)
treee1353167ea74077cd0e6864d238f64ac55fc01d9 /object-file.c
parent786a3e4b8d754d2b14b1208b98eeb0a554ef19a8 (diff)
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 <e@80x24.org> Acked-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-file.c')
-rw-r--r--object-file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/object-file.c b/object-file.c
index 610b1f465c..dd441627d6 100644
--- a/object-file.c
+++ b/object-file.c
@@ -1711,9 +1711,9 @@ static int oid_object_info_convert(struct repository *r,
ret = convert_object_file(&outbuf,
the_hash_algo, input_algo,
content, size, type, !do_die);
+ free(content);
if (ret == -1)
return -1;
- free(content);
size = outbuf.len;
content = strbuf_detach(&outbuf, NULL);
}