forked from wolfSSL/wolfssl
Set some freed data to NULL
This commit is contained in:
@ -9672,6 +9672,9 @@ static int test_wolfSSL_PKCS12(void)
|
|||||||
AssertNotNull(pkey);
|
AssertNotNull(pkey);
|
||||||
AssertNotNull(cert);
|
AssertNotNull(cert);
|
||||||
|
|
||||||
|
wolfSSL_EVP_PKEY_free(pkey);
|
||||||
|
wolfSSL_X509_free(cert);
|
||||||
|
|
||||||
/* check parse with extra certs kept */
|
/* check parse with extra certs kept */
|
||||||
ret = PKCS12_parse(pkcs12, "wolfSSL test", &pkey, &cert, &ca);
|
ret = PKCS12_parse(pkcs12, "wolfSSL test", &pkey, &cert, &ca);
|
||||||
AssertIntEQ(ret, WOLFSSL_SUCCESS);
|
AssertIntEQ(ret, WOLFSSL_SUCCESS);
|
||||||
|
@ -156,11 +156,14 @@ static void freeSafe(AuthenticatedSafe* safe, void* heap)
|
|||||||
ContentInfo* ci = safe->CI;
|
ContentInfo* ci = safe->CI;
|
||||||
safe->CI = ci->next;
|
safe->CI = ci->next;
|
||||||
XFREE(ci, heap, DYNAMIC_TYPE_PKCS);
|
XFREE(ci, heap, DYNAMIC_TYPE_PKCS);
|
||||||
|
ci = NULL;
|
||||||
}
|
}
|
||||||
if (safe->data != NULL) {
|
if (safe->data != NULL) {
|
||||||
XFREE(safe->data, heap, DYNAMIC_TYPE_PKCS);
|
XFREE(safe->data, heap, DYNAMIC_TYPE_PKCS);
|
||||||
|
safe->data = NULL;
|
||||||
}
|
}
|
||||||
XFREE(safe, heap, DYNAMIC_TYPE_PKCS);
|
XFREE(safe, heap, DYNAMIC_TYPE_PKCS);
|
||||||
|
safe = NULL;
|
||||||
|
|
||||||
(void)heap;
|
(void)heap;
|
||||||
}
|
}
|
||||||
@ -207,6 +210,7 @@ void wc_PKCS12_free(WC_PKCS12* pkcs12)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
XFREE(pkcs12, NULL, DYNAMIC_TYPE_PKCS);
|
XFREE(pkcs12, NULL, DYNAMIC_TYPE_PKCS);
|
||||||
|
pkcs12 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user