mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 20:30:38 +09: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>
(cherry picked from commit b5dc8197f7)
This commit is contained in:
committed by
Andreas Schneider
parent
584ab49b7b
commit
d2a990a68e
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user