forked from wolfSSL/wolfssl
fix freeing a failed RNG
This commit is contained in:
@ -507,13 +507,16 @@ int wc_FreeRng(RNG* rng)
|
|||||||
int ret = BAD_FUNC_ARG;
|
int ret = BAD_FUNC_ARG;
|
||||||
|
|
||||||
if (rng != NULL) {
|
if (rng != NULL) {
|
||||||
if (Hash_DRBG_Uninstantiate(rng->drbg) == DRBG_SUCCESS)
|
if (rng->drbg != NULL) {
|
||||||
ret = 0;
|
if (Hash_DRBG_Uninstantiate(rng->drbg) == DRBG_SUCCESS)
|
||||||
else
|
ret = 0;
|
||||||
ret = RNG_FAILURE_E;
|
else
|
||||||
|
ret = RNG_FAILURE_E;
|
||||||
|
|
||||||
|
XFREE(rng->drbg, NULL, DYNAMIC_TYPE_RNG);
|
||||||
|
rng->drbg = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
XFREE(rng->drbg, NULL, DYNAMIC_TYPE_RNG);
|
|
||||||
rng->drbg = NULL;
|
|
||||||
rng->status = DRBG_NOT_INIT;
|
rng->status = DRBG_NOT_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user