fix freeing a failed RNG

This commit is contained in:
John Safranek
2015-03-06 09:51:29 -08:00
parent d5975e39f8
commit 874fa8c1f9

View File

@ -507,6 +507,7 @@ int wc_FreeRng(RNG* rng)
int ret = BAD_FUNC_ARG; int ret = BAD_FUNC_ARG;
if (rng != NULL) { if (rng != NULL) {
if (rng->drbg != NULL) {
if (Hash_DRBG_Uninstantiate(rng->drbg) == DRBG_SUCCESS) if (Hash_DRBG_Uninstantiate(rng->drbg) == DRBG_SUCCESS)
ret = 0; ret = 0;
else else
@ -514,6 +515,8 @@ int wc_FreeRng(RNG* rng)
XFREE(rng->drbg, NULL, DYNAMIC_TYPE_RNG); XFREE(rng->drbg, NULL, DYNAMIC_TYPE_RNG);
rng->drbg = NULL; rng->drbg = NULL;
}
rng->status = DRBG_NOT_INIT; rng->status = DRBG_NOT_INIT;
} }