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