diff options
author | Rich Salz <rsalz@openssl.org> | 2015-05-01 10:15:18 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-05-01 10:15:18 -0400 |
commit | efa7dd64443f246004751bdaa5671bf6836e07ff (patch) | |
tree | df55d807a97d046ce17eb12adca78ea36a6038fa /crypto/conf | |
parent | b548a1f11c06ccdfa4f52a539912d22d77ee309e (diff) |
free NULL cleanup 11
Don't check for NULL before calling free functions. This gets:
ERR_STATE_free
ENGINE_free
DSO_free
CMAC_CTX_free
COMP_CTX_free
CONF_free
NCONF_free NCONF_free_data _CONF_free_data
A sk_free use within OBJ_sigid_free
TS_TST_INFO_free (rest of TS_ API was okay)
Doc update for UI_free (all uses were fine)
X509V3_conf_free
X509V3_section_free
X509V3_string_free
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/conf')
-rw-r--r-- | crypto/conf/conf_api.c | 18 | ||||
-rw-r--r-- | crypto/conf/conf_mod.c | 8 |
2 files changed, 11 insertions, 15 deletions
diff --git a/crypto/conf/conf_api.c b/crypto/conf/conf_api.c index b41564b680..59808a301b 100644 --- a/crypto/conf/conf_api.c +++ b/crypto/conf/conf_api.c @@ -241,8 +241,7 @@ static void value_free_stack_doall(CONF_VALUE *a) OPENSSL_free(vv->name); OPENSSL_free(vv); } - if (sk != NULL) - sk_CONF_VALUE_free(sk); + sk_CONF_VALUE_free(sk); OPENSSL_free(a->section); OPENSSL_free(a); } @@ -251,7 +250,7 @@ static void value_free_stack_doall(CONF_VALUE *a) CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) { STACK_OF(CONF_VALUE) *sk = NULL; - int ok = 0, i; + int i; CONF_VALUE *v = NULL, *vv; if ((sk = sk_CONF_VALUE_new_null()) == NULL) @@ -268,13 +267,10 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) vv = lh_CONF_VALUE_insert(conf->data, v); OPENSSL_assert(vv == NULL); - ok = 1; + return v; + err: - if (!ok) { - if (sk != NULL) - sk_CONF_VALUE_free(sk); - OPENSSL_free(v); - v = NULL; - } - return (v); + sk_CONF_VALUE_free(sk); + OPENSSL_free(v); + return NULL; } diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index ce2b177873..18fe38b302 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -266,8 +266,7 @@ static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, return md; err: - if (dso) - DSO_free(dso); + DSO_free(dso); CONFerr(CONF_F_MODULE_LOAD_DSO, errcode); ERR_add_error_data(4, "module=", name, ", path=", path); return NULL; @@ -422,8 +421,7 @@ void CONF_modules_unload(int all) /* unload a single module */ static void module_free(CONF_MODULE *md) { - if (md->dso) - DSO_free(md->dso); + DSO_free(md->dso); OPENSSL_free(md->name); OPENSSL_free(md); } @@ -445,6 +443,8 @@ void CONF_modules_finish(void) static void module_finish(CONF_IMODULE *imod) { + if (!imod) + return; if (imod->pmod->finish) imod->pmod->finish(imod); imod->pmod->links--; |