Ensure return value is not 1 when memory allocation fails #1618

This commit is contained in:
Ian Craggs 2026-02-16 16:48:26 +00:00
parent cfcff0aa5d
commit afcdeb5945
No known key found for this signature in database
GPG Key ID: A7AE1A8F2CCAB186
1 changed files with 4 additions and 2 deletions

View File

@ -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;
}