free null cleanup finale

Don't check for NULL before calling OPENSSL_free

Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Rich Salz
2015-05-01 10:02:07 -04:00
parent 33fbca83dc
commit b548a1f11c
173 changed files with 509 additions and 1012 deletions

View File

@@ -384,10 +384,8 @@ int srp_main(int argc, char **argv)
errorline, configfile);
goto end;
}
if (tofree) {
OPENSSL_free(tofree);
tofree = NULL;
}
OPENSSL_free(tofree);
tofree = NULL;
/* Lets get the config section we are using */
if (section == NULL) {
@@ -519,26 +517,16 @@ int srp_main(int argc, char **argv)
row[DB_srpgN] = BUF_strdup(gNid);
if (!row[DB_srpid] || !row[DB_srpgN] || !row[DB_srptype]
|| !row[DB_srpverifier] || !row[DB_srpsalt] || (userinfo
&&
(!(row
[DB_srpinfo]
=
BUF_strdup
(userinfo))))
|| !row[DB_srpverifier] || !row[DB_srpsalt]
|| (userinfo &&
(!(row [DB_srpinfo] = BUF_strdup (userinfo))))
|| !update_index(db, row)) {
if (row[DB_srpid])
OPENSSL_free(row[DB_srpid]);
if (row[DB_srpgN])
OPENSSL_free(row[DB_srpgN]);
if (row[DB_srpinfo])
OPENSSL_free(row[DB_srpinfo]);
if (row[DB_srptype])
OPENSSL_free(row[DB_srptype]);
if (row[DB_srpverifier])
OPENSSL_free(row[DB_srpverifier]);
if (row[DB_srpsalt])
OPENSSL_free(row[DB_srpsalt]);
OPENSSL_free(row[DB_srpid]);
OPENSSL_free(row[DB_srpgN]);
OPENSSL_free(row[DB_srpinfo]);
OPENSSL_free(row[DB_srptype]);
OPENSSL_free(row[DB_srpverifier]);
OPENSSL_free(row[DB_srpsalt]);
goto end;
}
doupdatedb = 1;
@@ -676,8 +664,7 @@ int srp_main(int argc, char **argv)
if (verbose)
BIO_printf(bio_err, "SRP terminating with code %d.\n", ret);
if (tofree)
OPENSSL_free(tofree);
OPENSSL_free(tofree);
if (ret)
ERR_print_errors(bio_err);
if (randfile)