sftp: Fix a possible null pointer dereference

CID 1395721

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit cc83b463ce)
This commit is contained in:
Andreas Schneider
2018-09-18 10:19:29 +02:00
parent c2bc4e62dd
commit ded4a81ffe

View File

@@ -163,10 +163,12 @@ error:
if (sftp->channel != NULL) { if (sftp->channel != NULL) {
ssh_channel_free(sftp->channel); ssh_channel_free(sftp->channel);
} }
if (sftp->read_packet != NULL) {
if (sftp->read_packet->payload != NULL) { if (sftp->read_packet->payload != NULL) {
ssh_buffer_free(sftp->read_packet->payload); ssh_buffer_free(sftp->read_packet->payload);
} }
SAFE_FREE(sftp->read_packet); SAFE_FREE(sftp->read_packet);
}
SAFE_FREE(sftp); SAFE_FREE(sftp);
return NULL; return NULL;
} }