In an attempt to retain the memory to the string name in main_cmds, we unfortunately leaked the struct cmdname that held it. Fix this by creating a copy of the name. Signed-off-by: Tay Ray Chuan <rctay89@xxxxxxxxx> --- help.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/help.c b/help.c index 705f152..f296d95 100644 --- a/help.c +++ b/help.c @@ -360,8 +360,7 @@ const char *help_unknown_cmd(const char *cmd) ; /* still counting */ } if (autocorrect && n == 1 && SIMILAR_ENOUGH(best_similarity)) { - const char *assumed = main_cmds.names[0]->name; - main_cmds.names[0] = NULL; + const char *assumed = xstrdup(main_cmds.names[0]->name); clean_cmdnames(&main_cmds); fprintf_ln(stderr, _("WARNING: You called a Git command named '%s', " -- 1.7.10.1.611.g8a79d96 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html