aboutsummaryrefslogtreecommitdiff
path: root/src/messages.c
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2019-01-14 18:27:28 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-01-26 13:56:15 +0100
commit5ed5e97114bfe83473f398056653e7149cc285dd (patch)
treeed219ce468ac8ec35871713cd5c9e077f5f3a905 /src/messages.c
parent6dacc8b26c14802afdc54611af9a4d74d44672b8 (diff)
downloadlibssh-5ed5e97114bfe83473f398056653e7149cc285dd.tar.gz
libssh-5ed5e97114bfe83473f398056653e7149cc285dd.tar.xz
libssh-5ed5e97114bfe83473f398056653e7149cc285dd.zip
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>
Diffstat (limited to 'src/messages.c')
-rw-r--r--src/messages.c2
1 files changed, 1 insertions, 1 deletions
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