From fdb3221ea775ff1c1fe1d3e2cf3383b83b6bd6b9 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Thu, 25 Mar 2021 23:07:23 +0700 Subject: [PATCH] check variable is not null before use in error case --- src/ssl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 88527a3a2..a1c7c70ea 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -3888,8 +3888,10 @@ error: if (sk) wolfSSL_sk_X509_free(sk); - for (i = 0; i < numCerts && certBuffers[i] != NULL; ++i) { - FreeDer(&certBuffers[i]); + if (certBuffers != NULL) { + for (i = 0; i < numCerts && certBuffers[i] != NULL; ++i) { + FreeDer(&certBuffers[i]); + } } if (certBuffers)