From ae23f777d67c9e3facd29df89d8cd9bf54b29912 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 2 Mar 2018 11:35:16 -0700 Subject: [PATCH] clean up memory in error case with PKCS12 create --- src/ssl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ssl.c b/src/ssl.c index 26de6b3f4..d91b5f2ac 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -18268,12 +18268,14 @@ WC_PKCS12* wolfSSL_PKCS12_create(char* pass, char* name, curDer = (byte*)wolfSSL_X509_get_der(sk->data.x509, &curDerSz); if (certDer == NULL || curDerSz < 0) { + XFREE(cur, NULL, DYNAMIC_TYPE_PKCS); wc_FreeCertList(list, NULL); return NULL; } cur->buffer = (byte*)XMALLOC(curDerSz, NULL, DYNAMIC_TYPE_PKCS); if (cur->buffer == NULL) { + XFREE(cur, NULL, DYNAMIC_TYPE_PKCS); wc_FreeCertList(list, NULL); return NULL; }