sftp: Fix a possible null pointer dereference

CID 1395721

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider 2018-09-18 10:19:29 +02:00
parent 39975fdd6d
commit cc83b463ce

View File

@ -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;
}