1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-27 13:21:11 +03:00

Fix leak of sftp->ext when sftp_new() fails

Signed-off-by: Kevin Fan <kevinfan@google.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Kevin Fan
2015-04-14 11:40:04 -07:00
committed by Andreas Schneider
parent 19e23e6128
commit b5dc8197f7

View File

@@ -126,6 +126,7 @@ sftp_session sftp_new(ssh_session session){
sftp->session = session;
sftp->channel = ssh_channel_new(session);
if (sftp->channel == NULL) {
sftp_ext_free(sftp->ext);
SAFE_FREE(sftp);
return NULL;
@@ -133,6 +134,7 @@ sftp_session sftp_new(ssh_session session){
if (ssh_channel_open_session(sftp->channel)) {
ssh_channel_free(sftp->channel);
sftp_ext_free(sftp->ext);
SAFE_FREE(sftp);
return NULL;