Fix error handling in rand_drbg_new
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Tue, 30 Oct 2018 19:57:53 +0000 (20:57 +0100)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 5 Nov 2018 21:46:20 +0000 (22:46 +0100)
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7519)

crypto/rand/drbg_lib.c

index b9c1cca0e0d06857cc1adc09fa4198cb538450cc..1471681cf47c48a252c205904285566a87c6d825 100644 (file)
@@ -234,10 +234,7 @@ static RAND_DRBG *rand_drbg_new(int secure,
     return drbg;
 
  err:
-    if (drbg->secure)
-        OPENSSL_secure_free(drbg);
-    else
-        OPENSSL_free(drbg);
+    RAND_DRBG_free(drbg);
 
     return NULL;
 }