If an engine comes up explicitely, it must also come down explicitely
[openssl.git] / apps / rand.c
index e6e9e3ead4b4ee67d5ff9bbd72cd9889c573d18d..33dbf57d9c16959d670ce0a4b1042054b8ba9a87 100644 (file)
@@ -39,6 +39,7 @@ const OPTIONS rand_options[] = {
 
 int rand_main(int argc, char **argv)
 {
+    ENGINE *e = NULL;
     BIO *out = NULL;
     char *inrand = NULL, *outfile = NULL, *prog;
     OPTION_CHOICE o;
@@ -60,7 +61,7 @@ int rand_main(int argc, char **argv)
             outfile = opt_arg();
             break;
         case OPT_ENGINE:
-            (void)setup_engine(opt_arg(), 0);
+            e = setup_engine(opt_arg(), 0);
             break;
         case OPT_RAND:
             inrand = opt_arg();
@@ -125,6 +126,7 @@ int rand_main(int argc, char **argv)
  end:
     if (ret != 0)
         ERR_print_errors(bio_err);
+    release_engine(e);
     BIO_free_all(out);
     return (ret);
 }