Skip to content

Commit

Permalink
Plug a memleak in builtin-revert
Browse files Browse the repository at this point in the history
Probably happened when working around git_path's problem with returned
buffer being reused.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Alex Riesen authored and Junio C Hamano committed Oct 30, 2008
1 parent 6e381d3 commit d258b25
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin-revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit d258b25

Please sign in to comment.