From: Jeff King Date: Thu, 20 Apr 2017 20:21:58 +0000 (-0400) Subject: connect.c: fix leak in handle_ssh_variant X-Git-Tag: v2.13.0-rc1~4^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d2993b6eabb0e0efdbe17bd43a3bec07a1670be;p=thirdparty%2Fgit.git connect.c: fix leak in handle_ssh_variant When we see an error from split_cmdline(), we exit the function without freeing the copy of the command string we made. This was sort-of introduced by 22e5ae5c8 (connect.c: handle errors from split_cmdline, 2017-04-10). The leak existed before that, but before that commit fixed the bug, we could never trigger this else clause in the first place. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/connect.c b/connect.c index 6f2281ab0f..380997afdd 100644 --- a/connect.c +++ b/connect.c @@ -738,8 +738,10 @@ static void handle_ssh_variant(const char *ssh_command, int is_cmdline, * any longer. */ free(ssh_argv); - } else + } else { + free(p); return; + } } if (!strcasecmp(variant, "plink") ||