[Bug 246596] Memory leak in ctld
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Wed May 20 09:40:11 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246596
Bug ID: 246596
Summary: Memory leak in ctld
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: bugs at FreeBSD.org
Reporter: patrykkotlowski at gmail.com
In ucl_parse.c file there is memory leak:
int
uclparse_conf(struct conf *newconf, const char *path)
{
struct ucl_parser *parser;
int error;
conf = newconf;
parser = ucl_parser_new(0);
if (!ucl_parser_add_file(parser, path)) {
log_warn("unable to parse configuration file %s: %s", path,
ucl_parser_get_error(parser));
return (1);
}
error = uclparse_toplevel(ucl_parser_get_object(parser));
return (error);
}
ucl_parser pointer is never freed.
My fix proposal is following (I tested it in my production environment):
int
uclparse_conf(struct conf *newconf, const char *path)
{
struct ucl_parser *parser;
int error;
conf = newconf;
parser = ucl_parser_new(0);
if (!ucl_parser_add_file(parser, path)) {
log_warn("unable to parse configuration file %s: %s", path,
ucl_parser_get_error(parser));
return (1);
}
ucl_object_t *p_top = ucl_parser_get_object(parser);
error = uclparse_toplevel(p_top);
ucl_object_unref(p_top);
ucl_parser_free(parser);
return (error);
}
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list