Make sure we free the CONF structure allocated by confdump
A travis build was failing because of a memory leak in confdump due to us not freeing an allocated CONF structure. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10429)
This commit is contained in:
parent
985412f8c1
commit
9386303086
1 changed files with 6 additions and 5 deletions
|
@ -51,10 +51,10 @@ static void dump_section(const char *name, const CONF *cnf)
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
long eline;
|
long eline;
|
||||||
CONF *conf;
|
CONF *conf = NCONF_new(NCONF_default());
|
||||||
|
int ret = 1;
|
||||||
|
|
||||||
if ((conf = NCONF_new(NCONF_default())) != NULL
|
if (conf != NULL && NCONF_load(conf, argv[1], &eline)) {
|
||||||
&& NCONF_load(conf, argv[1], &eline)) {
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
collect_all_sections(conf);
|
collect_all_sections(conf);
|
||||||
|
@ -62,9 +62,10 @@ int main(int argc, char **argv)
|
||||||
dump_section(sk_OPENSSL_CSTRING_value(section_names, i), conf);
|
dump_section(sk_OPENSSL_CSTRING_value(section_names, i), conf);
|
||||||
}
|
}
|
||||||
sk_OPENSSL_CSTRING_free(section_names);
|
sk_OPENSSL_CSTRING_free(section_names);
|
||||||
|
ret = 0;
|
||||||
} else {
|
} else {
|
||||||
ERR_print_errors_fp(stderr);
|
ERR_print_errors_fp(stderr);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
NCONF_free(conf);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue