aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2018-09-26 13:14:41 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-09-27 15:21:30 +0200
commitcc513c4c9a057d6ae4ac4a1e3c90e0fdc13845b1 (patch)
tree4f4f094339211ec9e90988bc31aaf0377446e841
parent31202822a720221773b32623ee582a8ed4722867 (diff)
downloadlibssh-cc513c4c9a057d6ae4ac4a1e3c90e0fdc13845b1.tar.gz
libssh-cc513c4c9a057d6ae4ac4a1e3c90e0fdc13845b1.tar.xz
libssh-cc513c4c9a057d6ae4ac4a1e3c90e0fdc13845b1.zip
messages: Fixed possible memory leak in ssh_message_queue
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/messages.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/messages.c b/src/messages.c
index 9ddfe15c..8733875c 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -430,6 +430,13 @@ void ssh_message_queue(ssh_session session, ssh_message message){
}
if (session->ssh_message_list != NULL) {
ssh_list_append(session->ssh_message_list, message);
+ } else {
+ /* If the message list couldn't be allocated, the message can't be
+ * enqueued */
+ ssh_message_reply_default(message);
+ ssh_set_error_oom(session);
+ ssh_message_free(message);
+ return;
}
}
}