diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-03-20 21:01:20 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-03-20 19:25:48 -0700 |
commit | 28db756feead84929cdfaaee8bccd301384daab4 (patch) | |
tree | 9b37553d3d40a0d238cd4ce10e47a96f03d9d920 | |
parent | rebase -i: use new --ff cherry-pick option (diff) | |
download | tgif-28db756feead84929cdfaaee8bccd301384daab4.tar.xz |
revert: fix tiny memory leak in cherry-pick --ff
We forgot to free defmsg when returning early for a fast-forward.
Fixing this should reduce noise during test suite runs with valgrind.
More importantly, once cherry-pick learns to pick multiple commits,
the amount of memory leaked would start to add up.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin-revert.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-revert.c b/builtin-revert.c index 476f41e760..9a3c14c329 100644 --- a/builtin-revert.c +++ b/builtin-revert.c @@ -274,7 +274,7 @@ static int revert_or_cherry_pick(int argc, const char **argv) int i, index_fd, clean; char *oneline, *reencoded_message = NULL; const char *message, *encoding; - char *defmsg = git_pathdup("MERGE_MSG"); + char *defmsg = NULL; struct merge_options o; struct tree *result, *next_tree, *base_tree, *head_tree; static struct lock_file index_lock; @@ -364,6 +364,7 @@ static int revert_or_cherry_pick(int argc, const char **argv) * reverse of it if we are revert. */ + defmsg = git_pathdup("MERGE_MSG"); msg_fd = hold_lock_file_for_update(&msg_file, defmsg, LOCK_DIE_ON_ERROR); |