mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-11 03:42:35 +03:00
sftpserver: Set OOM only if allocation fails
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Norbert Pocs <npocs@redhat.com>
This commit is contained in:
@@ -73,6 +73,7 @@ sftp_make_client_message(sftp_session sftp, sftp_packet packet)
|
|||||||
/* take a copy of the whole packet */
|
/* take a copy of the whole packet */
|
||||||
msg->complete_message = ssh_buffer_new();
|
msg->complete_message = ssh_buffer_new();
|
||||||
if (msg->complete_message == NULL) {
|
if (msg->complete_message == NULL) {
|
||||||
|
ssh_set_error_oom(session);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,14 +234,12 @@ sftp_make_client_message(sftp_session sftp, sftp_packet packet)
|
|||||||
default:
|
default:
|
||||||
ssh_set_error(sftp->session, SSH_FATAL,
|
ssh_set_error(sftp->session, SSH_FATAL,
|
||||||
"Received unhandled sftp message %d", msg->type);
|
"Received unhandled sftp message %d", msg->type);
|
||||||
sftp_client_message_free(msg);
|
goto error;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
ssh_set_error_oom(session);
|
|
||||||
sftp_client_message_free(msg);
|
sftp_client_message_free(msg);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user