From: Alex Riesen Date: Tue, 28 Oct 2008 17:27:33 +0000 (+0100) Subject: Plug a memleak in builtin-revert X-Git-Tag: v1.6.0.4~29 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d258b25887f763db96c20d4ec805ae685f55bdd1;p=git.git 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 --- diff --git a/builtin-revert.c b/builtin-revert.c index 27881e949..c41788685 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; }