Skip to content

Commit 0aaca0e

Browse files
pks-tgitster
authored andcommitted
builtin/log: fix leak when showing converted blob contents
In `show_blob_object()`, we proactively call `textconv_object()`. In case we have a textconv driver for this blob we will end up showing the converted contents, otherwise we'll show the un-converted contents of it instead. When the object has been converted we never free the buffer containing the converted contents. Fix this to plug this memory leak. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 38678e5 commit 0aaca0e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

builtin/log.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ static int show_blob_object(const struct object_id *oid, struct rev_info *rev, c
707707

708708
write_or_die(1, buf, size);
709709
object_context_release(&obj_context);
710+
free(buf);
710711
return 0;
711712
}
712713

t/t4030-diff-textconv.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

33
test_description='diff.*.textconv tests'
4+
5+
TEST_PASSES_SANITIZE_LEAK=true
46
. ./test-lib.sh
57

68
find_diff() {

0 commit comments

Comments
 (0)