Mailing List Archive

[PATCH] Fix memory leak in 'handle' allocated through function 'get_handle'
---
sftp-client.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/sftp-client.c b/sftp-client.c
index 4fb6181..df76b7a 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -632,6 +632,7 @@ do_lsreaddir(struct sftp_conn *conn, const char *path, int print_flag,
free(filename);
free(longname);
sshbuf_free(msg);
+ free(handle);
return -1;
}

--
2.7.4

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: [PATCH] Fix memory leak in 'handle' allocated through function 'get_handle' [ In reply to ]
On 25.09.2019 08:51, krishnaiah bommu wrote:
> ---
> sftp-client.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/sftp-client.c b/sftp-client.c
> index 4fb6181..df76b7a 100644
> --- a/sftp-client.c
> +++ b/sftp-client.c
> @@ -632,6 +632,7 @@ do_lsreaddir(struct sftp_conn *conn, const char *path, int print_flag,
> free(filename);
> free(longname);
> sshbuf_free(msg);
> + free(handle);
> return -1;

I have not carefully checked, but it looks like it still leaks everything pointed by (*dir). I'd rather probably considered (beware: totally untested)

- sshbuf_free(msg);
- return -1;
+ goto out;

> }
>
>
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev