diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-01 10:14:26 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-01 10:14:26 +0000 |
commit | f80efcc26070bb6d42fca830d80aed3fca82206e (patch) | |
tree | d8f151c766b0b00fa14d916c6f274bbfd8d03950 /libssh/sftp.c | |
parent | 2634f45e11020950f1c33b3793532850746d0023 (diff) | |
download | libssh-f80efcc26070bb6d42fca830d80aed3fca82206e.tar.gz libssh-f80efcc26070bb6d42fca830d80aed3fca82206e.tar.xz libssh-f80efcc26070bb6d42fca830d80aed3fca82206e.zip |
Add checks for memory errors in channel functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@314 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/sftp.c')
-rw-r--r-- | libssh/sftp.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libssh/sftp.c b/libssh/sftp.c index 927d71cb..4f6896ab 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); |