summaryrefslogtreecommitdiffstats
path: root/libssh/sftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'libssh/sftp.c')
-rw-r--r--libssh/sftp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libssh/sftp.c b/libssh/sftp.c
index 927d71c..4f6896a 100644
--- a/libssh/sftp.c
+++ b/libssh/sftp.c
@@ -49,6 +49,11 @@ SFTP_SESSION *sftp_new(SSH_SESSION *session){
memset(sftp,0,sizeof(SFTP_SESSION));
sftp->session=session;
sftp->channel=channel_new(session);
+ if (sftp->channel == NULL) {
+ SAFE_FREE(sftp);
+ leave_function();
+ return NULL;
+ }
if(channel_open_session(sftp->channel)){
channel_free(sftp->channel);
free(sftp);