X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fconf%2Fconf_mod.c;h=b01319fd399f2a2602276823852174b938e7552f;hp=ce2b1778731924091ea42f47ee96cc37eb0fd4ef;hb=86885c289580066792415218754bd935b449f170;hpb=b548a1f11c06ccdfa4f52a539912d22d77ee309e diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index ce2b177873..b01319fd39 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; @@ -282,7 +281,7 @@ static CONF_MODULE *module_add(DSO *dso, const char *name, supported_modules = sk_CONF_MODULE_new_null(); if (supported_modules == NULL) return NULL; - tmod = OPENSSL_malloc(sizeof(CONF_MODULE)); + tmod = OPENSSL_malloc(sizeof(*tmod)); if (tmod == NULL) return NULL; @@ -320,7 +319,7 @@ static CONF_MODULE *module_find(char *name) for (i = 0; i < sk_CONF_MODULE_num(supported_modules); i++) { tmod = sk_CONF_MODULE_value(supported_modules, i); - if (!strncmp(tmod->name, name, nchar)) + if (strncmp(tmod->name, name, nchar) == 0) return tmod; } @@ -337,7 +336,7 @@ static int module_init(CONF_MODULE *pmod, char *name, char *value, CONF_IMODULE *imod = NULL; /* Otherwise add initialized module to list */ - imod = OPENSSL_malloc(sizeof(CONF_IMODULE)); + imod = OPENSSL_malloc(sizeof(*imod)); if (!imod) goto err; @@ -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--;