Fix error handling in rand_drbg_new
[openssl.git] / crypto / rand / drbg_lib.c
index f518ce5..cd298a7 100644 (file)
@@ -295,10 +295,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;
 }