summaryrefslogtreecommitdiff
path: root/builtin-revert.c
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2008-10-28 18:27:33 +0100
committerJunio C Hamano <gitster@pobox.com>2008-10-30 14:01:00 -0700
commitd258b25887f763db96c20d4ec805ae685f55bdd1 (patch)
tree55f3aafcfc5442caa9902feabcad5e7d1f830700 /builtin-revert.c
parent6e381d3aff89e09d13bd855ed6e18b0aa6f1e441 (diff)
downloadgit-d258b25887f763db96c20d4ec805ae685f55bdd1.tar.gz
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 <gitster@pobox.com>
Diffstat (limited to 'builtin-revert.c')
-rw-r--r--builtin-revert.c3
1 files changed, 2 insertions, 1 deletions
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;
}