From afcdeb59459d94724f9b139319e765946b59647a Mon Sep 17 00:00:00 2001 From: Ian Craggs Date: Mon, 16 Feb 2026 16:48:26 +0000 Subject: [PATCH] Ensure return value is not 1 when memory allocation fails #1618 --- src/SSLSocket.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SSLSocket.c b/src/SSLSocket.c index c5aca72e..7a9827a0 100644 --- a/src/SSLSocket.c +++ b/src/SSLSocket.c @@ -27,6 +27,7 @@ */ #if defined(OPENSSL) +#include "Heap.h" #include "SocketBuffer.h" #include "MQTTClient.h" @@ -727,9 +728,10 @@ int SSLSocket_setSocketForSSL(networkHandles* net, MQTTClient_SSLOptions* opts, if ((net->ssl = SSL_new(net->ctx)) == NULL) { if (opts->struct_version >= 3) - rc = SSLSocket_error("SSL_new", net->ssl, net->socket, rc, opts->ssl_error_cb, opts->ssl_error_context); + SSLSocket_error("SSL_new", net->ssl, net->socket, rc, opts->ssl_error_cb, opts->ssl_error_context); else - rc = SSLSocket_error("SSL_new", net->ssl, net->socket, rc, NULL, NULL); + SSLSocket_error("SSL_new", net->ssl, net->socket, rc, NULL, NULL); + rc = PAHO_MEMORY_ERROR; goto exit; }