summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2017-07-07 04:43:16 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-07-07 09:04:34 -0700
commite30d463d450286ffafb442ecc7686df4004c06ff (patch)
tree10387528a64aa4361f8e19b8efa8e806cdd69eb0 /t
parentreflog-walk: don't free reflogs added to cache (diff)
downloadtgif-e30d463d450286ffafb442ecc7686df4004c06ff.tar.xz
reflog-walk: include all fields when freeing complete_reflogs
When we encounter an error adding reflogs for a walk, we try to free any logs we have read. But we didn't free all fields, meaning that we could in theory leak all of the "items" array (which would consitute the bulk of the allocated memory). This patch adds a helper which frees all of the entries and uses it as appropriate. As it turns out, the leak seems impossible to trigger with the current code. Of the three error paths that free the complete_reflogs struct, two only kick in when the items array is empty, and the third was removed entirely in the previous commit. So this patch should be a noop in terms of behavior, but it fixes a potential maintenance headache should anybody add a new error path and copy the partial-free code. Which is what happened in 5026b47175 (add_reflog_for_walk: avoid memory leak, 2017-05-04), though its leaky call was the third one that was recently removed. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
0 files changed, 0 insertions, 0 deletions