From 5ed5e97114bfe83473f398056653e7149cc285dd Mon Sep 17 00:00:00 2001 From: Anderson Toshiyuki Sasaki Date: Mon, 14 Jan 2019 18:27:28 +0100 Subject: [PATCH] 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 Reviewed-by: Andreas Schneider --- src/messages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/messages.c b/src/messages.c index 9be800bb..f65a484c 100644 --- a/src/messages.c +++ b/src/messages.c @@ -448,7 +448,7 @@ static void ssh_message_queue(ssh_session session, ssh_message message) if (session->ssh_message_list == NULL) { 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 * enqueued