Properly own the duplicated string

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Dmitry-Me 2016-03-09 15:25:07 +03:00 committed by Richard Levitte
parent 399de49699
commit b7b8e94801

View File

@ -286,8 +286,13 @@ static CONF_MODULE *module_add(DSO *dso, const char *name,
tmod->name = OPENSSL_strdup(name);
tmod->init = ifunc;
tmod->finish = ffunc;
if (tmod->name == NULL) {
OPENSSL_free(tmod);
return NULL;
}
if (!sk_CONF_MODULE_push(supported_modules, tmod)) {
OPENSSL_free(tmod->name);
OPENSSL_free(tmod);
return NULL;
}