From f07be76f51ff55aa63542ba2a5b888042eb57aed Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 21 Apr 2017 14:53:58 +0200 Subject: [PATCH] handle_ssh_variant: plug memory leak The split_cmdline() function either assigns an allocated array to the argv parameter or NULL. In the first case, we have to free() it, in the latter it does no harm. Reported via Coverity. Signed-off-by: Johannes Schindelin --- connect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connect.c b/connect.c index 7f1f802396..a38e567976 100644 --- a/connect.c +++ b/connect.c @@ -716,8 +716,10 @@ static int handle_ssh_variant(const char *ssh_command, int is_cmdline, * any longer. */ free(ssh_argv); - } else + } else { + free(ssh_argv); return 0; + } } if (!strcasecmp(variant, "plink") ||