NULL tofree when it is freed to avoid double free.

Make sure key is not NULL before freeing it.
This commit is contained in:
Dr. Stephen Henson 2003-01-09 13:05:57 +00:00
parent 3f1cbad2e7
commit 8ce7348625

View file

@ -76,6 +76,8 @@
#include <openssl/ocsp.h>
#include <openssl/pem.h>
#include <dmalloc.h>
#ifdef OPENSSL_SYS_WINDOWS
#define strcasecmp _stricmp
#else
@ -597,7 +599,10 @@ bad:
goto err;
}
if(tofree)
{
OPENSSL_free(tofree);
tofree = NULL;
}
if (!load_config(bio_err, conf))
goto err;
@ -1637,7 +1642,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);