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:
committed by
Andreas Schneider
parent
19e23e6128
commit
b5dc8197f7
@@ -126,6 +126,7 @@ sftp_session sftp_new(ssh_session session){
|
|||||||
sftp->session = session;
|
sftp->session = session;
|
||||||
sftp->channel = ssh_channel_new(session);
|
sftp->channel = ssh_channel_new(session);
|
||||||
if (sftp->channel == NULL) {
|
if (sftp->channel == NULL) {
|
||||||
|
sftp_ext_free(sftp->ext);
|
||||||
SAFE_FREE(sftp);
|
SAFE_FREE(sftp);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -133,6 +134,7 @@ sftp_session sftp_new(ssh_session session){
|
|||||||
|
|
||||||
if (ssh_channel_open_session(sftp->channel)) {
|
if (ssh_channel_open_session(sftp->channel)) {
|
||||||
ssh_channel_free(sftp->channel);
|
ssh_channel_free(sftp->channel);
|
||||||
|
sftp_ext_free(sftp->ext);
|
||||||
SAFE_FREE(sftp);
|
SAFE_FREE(sftp);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user