diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2018-09-18 10:19:29 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-09-18 10:19:59 +0200 |
commit | cc83b463cec56592b0da406cf0beba294b731e57 (patch) | |
tree | adfd22344a2b10754dbe2bbee7ceaf9c4d126aa9 | |
parent | 39975fdd6d6f9baf030c024d587d617b14d67d1d (diff) | |
download | libssh-cc83b463cec56592b0da406cf0beba294b731e57.tar.gz libssh-cc83b463cec56592b0da406cf0beba294b731e57.tar.xz libssh-cc83b463cec56592b0da406cf0beba294b731e57.zip |
sftp: Fix a possible null pointer dereference
CID 1395721
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | src/sftp.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -163,10 +163,12 @@ error: if (sftp->channel != NULL) { ssh_channel_free(sftp->channel); } - if (sftp->read_packet->payload != NULL) { - ssh_buffer_free(sftp->read_packet->payload); + if (sftp->read_packet != NULL) { + if (sftp->read_packet->payload != NULL) { + ssh_buffer_free(sftp->read_packet->payload); + } + SAFE_FREE(sftp->read_packet); } - SAFE_FREE(sftp->read_packet); SAFE_FREE(sftp); return NULL; } |