summaryrefslogtreecommitdiff
path: root/t/t4013/diff.diff-tree_--cc_--stat_master
diff options
context:
space:
mode:
authorLibravatar René Scharfe <rene.scharfe@lsrfire.ath.cx>2012-03-06 20:37:23 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-04-10 16:36:23 -0700
commit6ff264ee05cc8fd6b2c796623eadb8662444a458 (patch)
treec34d0fc6bf624c4e294d099b26f63b06aad06b27 /t/t4013/diff.diff-tree_--cc_--stat_master
parentunpack-trees: don't perform any index operation if we're not merging (diff)
downloadtgif-6ff264ee05cc8fd6b2c796623eadb8662444a458.tar.xz
unpack-trees: plug minor memory leak
The allocations made by unpack_nondirectories() using create_ce_entry() are never freed. In the non-merge case, we duplicate them using add_entry() and later only look at the first allocated element (src[0]), perhaps even only by mistake. Split out the actual addition from add_entry() into the new helper do_add_entry() and call this non-duplicating function instead of add_entry() to avoid the leak. Valgrind reports this for the command "git archive v1.7.9" without the patch: ==13372== LEAK SUMMARY: ==13372== definitely lost: 230,986 bytes in 2,325 blocks ==13372== indirectly lost: 0 bytes in 0 blocks ==13372== possibly lost: 98 bytes in 1 blocks ==13372== still reachable: 2,259,198 bytes in 3,243 blocks ==13372== suppressed: 0 bytes in 0 blocks And with the patch applied: ==13375== LEAK SUMMARY: ==13375== definitely lost: 65 bytes in 1 blocks ==13375== indirectly lost: 0 bytes in 0 blocks ==13375== possibly lost: 0 bytes in 0 blocks ==13375== still reachable: 2,364,417 bytes in 3,245 blocks ==13375== suppressed: 0 bytes in 0 blocks Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff-tree_--cc_--stat_master')
0 files changed, 0 insertions, 0 deletions