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>
Alex Riesen committed
Oct 28, 2008 at 18:27 UTC
d258b25887f763db96c20d4ec805ae685f55bdd1
1 file changed
+2
-1
builtin-revert.c
+2
-1
@@ -269,7 +269,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
269
int i;
270
char *oneline, *reencoded_message = NULL;
271
const char *message, *encoding;
272
- const char *defmsg = xstrdup(git_path("MERGE_MSG"));
272
+ char *defmsg = xstrdup(git_path("MERGE_MSG"));
273
274
git_config(git_default_config, NULL);
275
me = action == REVERT ? "revert" : "cherry-pick";
@@ -426,6 +426,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
426
return execv_git_cmd(args);
427
}
428
free(reencoded_message);
429
+ free(defmsg);
430
431
return 0;
432
}