Set some freed data to NULL

This commit is contained in:
Lealem Amedie
2023-03-10 13:40:25 -07:00
parent 13867dab12
commit 1c9fa5c5ae
2 changed files with 7 additions and 0 deletions

View File

@ -9672,6 +9672,9 @@ static int test_wolfSSL_PKCS12(void)
AssertNotNull(pkey);
AssertNotNull(cert);
wolfSSL_EVP_PKEY_free(pkey);
wolfSSL_X509_free(cert);
/* check parse with extra certs kept */
ret = PKCS12_parse(pkcs12, "wolfSSL test", &pkey, &cert, &ca);
AssertIntEQ(ret, WOLFSSL_SUCCESS);

View File

@ -156,11 +156,14 @@ static void freeSafe(AuthenticatedSafe* safe, void* heap)
ContentInfo* ci = safe->CI;
safe->CI = ci->next;
XFREE(ci, heap, DYNAMIC_TYPE_PKCS);
ci = NULL;
}
if (safe->data != NULL) {
XFREE(safe->data, heap, DYNAMIC_TYPE_PKCS);
safe->data = NULL;
}
XFREE(safe, heap, DYNAMIC_TYPE_PKCS);
safe = NULL;
(void)heap;
}
@ -207,6 +210,7 @@ void wc_PKCS12_free(WC_PKCS12* pkcs12)
#endif
XFREE(pkcs12, NULL, DYNAMIC_TYPE_PKCS);
pkcs12 = NULL;
}