From d258b25887f763db96c20d4ec805ae685f55bdd1 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Tue, 28 Oct 2008 18:27:33 +0100 Subject: [PATCH] Plug a memleak in builtin-revert Probably happened when working around git_path's problem with returned buffer being reused. Signed-off-by: Junio C Hamano --- builtin-revert.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin-revert.c b/builtin-revert.c index 27881e9493..c41788685b 100644 --- a/builtin-revert.c +++ b/builtin-revert.c @@ -269,7 +269,7 @@ static int revert_or_cherry_pick(int argc, const char **argv) int i; char *oneline, *reencoded_message = NULL; const char *message, *encoding; - const char *defmsg = xstrdup(git_path("MERGE_MSG")); + char *defmsg = xstrdup(git_path("MERGE_MSG")); git_config(git_default_config, NULL); me = action == REVERT ? "revert" : "cherry-pick"; @@ -426,6 +426,7 @@ static int revert_or_cherry_pick(int argc, const char **argv) return execv_git_cmd(args); } free(reencoded_message); + free(defmsg); return 0; } -- 2.11.4.GIT