1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

messages: Fix NULL check, preventing SEGFAULT

The wrong conditional check for newly allocated memory would make the
function to fail when the allocation was successful and access invalid
memory when the allocation failed.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Anderson Toshiyuki Sasaki
2019-01-14 18:27:28 +01:00
committed by Andreas Schneider
parent 6dacc8b26c
commit 5ed5e97114

View File

@@ -448,7 +448,7 @@ static void ssh_message_queue(ssh_session session, ssh_message message)
if (session->ssh_message_list == NULL) { if (session->ssh_message_list == NULL) {
session->ssh_message_list = ssh_list_new(); session->ssh_message_list = ssh_list_new();
if (session->ssh_message_list != NULL) { if (session->ssh_message_list == NULL) {
/* /*
* If the message list couldn't be allocated, the message can't be * If the message list couldn't be allocated, the message can't be
* enqueued * enqueued