aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-09-18 10:19:29 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-09-18 10:19:59 +0200
commitcc83b463cec56592b0da406cf0beba294b731e57 (patch)
treeadfd22344a2b10754dbe2bbee7ceaf9c4d126aa9
parent39975fdd6d6f9baf030c024d587d617b14d67d1d (diff)
downloadlibssh-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.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/sftp.c b/src/sftp.c
index 4b310acf..247e6b9c 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -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;
}