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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 20, 2017 at 16:21 UTC
5d2993b6eabb0e0efdbe17bd43a3bec07a1670be
1 file changed
+3
-1
connect.c
+3
-1
@@ -738,8 +738,10 @@ static void handle_ssh_variant(const char *ssh_command, int is_cmdline,
738
* any longer.
739
*/
740
free(ssh_argv);
741
- } else
741
+ } else {
742
+ free(p);
743
return;
744
+ }
745
}
746
747
if (!strcasecmp(variant, "plink") ||