diff options
author | Jeff King <peff@peff.net> | 2014-06-19 17:29:48 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-19 15:20:56 -0700 |
commit | f33206992de994424036a7d9912a968ab9829e6e (patch) | |
tree | 1d3c9a7bfafe5498ba00c7945942d9ed824f2dd6 /t/t5515/fetch.master_.._.git | |
parent | merge: use argv_array when spawning merge strategy (diff) | |
download | tgif-f33206992de994424036a7d9912a968ab9829e6e.tar.xz |
walker_fetch: fix minor memory leak
We sometimes allocate "msg" on the heap, but will fail to
free it if we hit the failure code path. We can instead keep
a separate variable that is safe to be freed no matter how
we get to the failure code path.
While we're here, we can also do two readability
improvements:
1. Use xstrfmt instead of a manual malloc/sprintf
2. Due to the "maybe we allocate msg, maybe we don't"
strategy, the logic for deciding which message to show
was split into two parts. Since the deallocation is now
pushed onto a separate variable, this is no longer a
concern, and we can keep all of the logic in the same
place.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5515/fetch.master_.._.git')
0 files changed, 0 insertions, 0 deletions