NULL tofree when it is freed to avoid double free.
[openssl.git] / apps / ca.c
index 8cb5342ce0c5dc0d15b1c53baf1fcc334177b5ae..0ef23ad79fe54a45e97f34d203191663ae10d9ad 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -597,7 +597,10 @@ bad:
                goto err;
                }
        if(tofree)
+               {
                OPENSSL_free(tofree);
+               tofree = NULL;
+               }
 
        if (!load_config(bio_err, conf))
                goto err;
@@ -1021,7 +1024,7 @@ bad:
                        }
 
                if (verbose)
-                       BIO_printf(bio_err, "Succesfully loaded extensions file %s\n", extfile);
+                       BIO_printf(bio_err, "Successfully loaded extensions file %s\n", extfile);
 
                /* We can have sections in the ext file */
                if (!extensions && !(extensions = NCONF_get_string(extconf, "default", "extensions")))
@@ -1642,7 +1645,7 @@ err:
 
        if (ret) ERR_print_errors(bio_err);
        app_RAND_write_file(randfile, bio_err);
-       if (free_key)
+       if (free_key & key)
                OPENSSL_free(key);
        BN_free(serial);
        TXT_DB_free(db);