Skip to content

Commit f7b911f

Browse files
committed
src/ssl.c, src/internal.c: fix leak in wolfSSL_get_ciphers_compat(): fix gating (OPENSSL_EXTRA, not OPENSSL_ALL) in FreeSuites() re .suitesStack and .clSuitesStack, and similarly fix gating on the implementation of wolfSSL_sk_SSL_CIPHER_free(() and related.
src/ssl_sess: suppress false positive clang-analyzer-unix.Malloc "Argument to 'free()' is the address of a global variable".
1 parent 7698546 commit f7b911f

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

src/internal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8379,7 +8379,7 @@ void FreeKeyExchange(WOLFSSL* ssl)
83798379
/* Free up all memory used by Suites structure from WOLFSSL */
83808380
void FreeSuites(WOLFSSL* ssl)
83818381
{
8382-
#ifdef OPENSSL_ALL
8382+
#ifdef OPENSSL_EXTRA
83838383
if (ssl->suitesStack != NULL) {
83848384
/* Enough to free stack structure since WOLFSSL_CIPHER
83858385
* isn't allocated separately. */
@@ -8392,8 +8392,6 @@ void FreeSuites(WOLFSSL* ssl)
83928392
wolfSSL_sk_SSL_CIPHER_free(ssl->clSuitesStack);
83938393
ssl->clSuitesStack = NULL;
83948394
}
8395-
#endif
8396-
#ifdef OPENSSL_EXTRA
83978395
XFREE(ssl->clSuites, ssl->heap, DYNAMIC_TYPE_SUITES);
83988396
ssl->clSuites = NULL;
83998397
#endif
@@ -25350,6 +25348,8 @@ int SendAsyncData(WOLFSSL* ssl)
2535025348
*/
2535125349
static int ssl_in_handshake(WOLFSSL *ssl, int send)
2535225350
{
25351+
int SendAsyncData = 1;
25352+
(void)SendAsyncData;
2535325353
if (IsSCR(ssl)) {
2535425354
if (send) {
2535525355
/* allow sending data in SCR */

src/ssl.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21264,10 +21264,7 @@ void wolfSSL_print_all_errors_fp(XFILE fp)
2126421264

2126521265
/* Note: This is a huge section of API's - through
2126621266
* wolfSSL_X509_OBJECT_get0_X509_CRL */
21267-
#if defined(OPENSSL_ALL) || (defined(OPENSSL_EXTRA) && \
21268-
(defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || \
21269-
defined(HAVE_LIGHTY) || defined(WOLFSSL_HAPROXY) || \
21270-
defined(WOLFSSL_OPENSSH) || defined(HAVE_SBLIM_SFCB)))
21267+
#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA)
2127121268

2127221269
#if defined(USE_WOLFSSL_MEMORY) && !defined(WOLFSSL_DEBUG_MEMORY) && \
2127321270
!defined(WOLFSSL_STATIC_MEMORY)
@@ -21676,9 +21673,7 @@ void wolfSSL_THREADID_set_numeric(void* id, unsigned long val)
2167621673
}
2167721674
#endif
2167821675

21679-
#endif /* OPENSSL_ALL || (OPENSSL_EXTRA && (HAVE_STUNNEL || WOLFSSL_NGINX ||
21680-
* HAVE_LIGHTY || WOLFSSL_HAPROXY || WOLFSSL_OPENSSH ||
21681-
* HAVE_SBLIM_SFCB)) */
21676+
#endif /* OPENSSL_ALL || OPENSSL_EXTRA */
2168221677

2168321678
#ifdef HAVE_SNI
2168421679

src/ssl_sess.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4097,7 +4097,7 @@ void wolfSSL_FreeSession(WOLFSSL_CTX* ctx, WOLFSSL_SESSION* session)
40974097
ForceZero(session->sessionID, ID_LEN);
40984098

40994099
if (session->type == WOLFSSL_SESSION_TYPE_HEAP) {
4100-
XFREE(session, session->heap, DYNAMIC_TYPE_SESSION);
4100+
XFREE(session, session->heap, DYNAMIC_TYPE_SESSION); /* // NOLINT(clang-analyzer-unix.Malloc) */
41014101
}
41024102
}
41034103

0 commit comments

Comments
 (0)