From 365ee3eaa953b559ed2ffebc66f761aac90b1160 Mon Sep 17 00:00:00 2001 From: Yanray Wang Date: Wed, 22 Nov 2023 10:28:28 +0800 Subject: [PATCH] ssl_tls: return correct error code if mbedtls_calloc fails Signed-off-by: Yanray Wang --- library/ssl_tls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index b163e93c2..348894b45 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -306,7 +306,7 @@ static int resize_buffer(unsigned char **buffer, size_t len_new, size_t *len_old { unsigned char *resized_buffer = mbedtls_calloc(1, len_new); if (resized_buffer == NULL) { - return -1; + return MBEDTLS_ERR_SSL_ALLOC_FAILED; } /* We want to copy len_new bytes when downsizing the buffer, and