Skip to content

Commit 5d2993b

Browse files
peffgitster
authored andcommitted
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 22e5ae5 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 22e5ae5 commit 5d2993b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

connect.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,10 @@ static void handle_ssh_variant(const char *ssh_command, int is_cmdline,
738738
* any longer.
739739
*/
740740
free(ssh_argv);
741-
} else
741+
} else {
742+
free(p);
742743
return;
744+
}
743745
}
744746

745747
if (!strcasecmp(variant, "plink") ||

0 commit comments

Comments
 (0)