Date: Wed, 20 May 2020 09:40:11 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 246596] Memory leak in ctld Message-ID: <bug-246596-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D246596 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@FreeBSD.org Reporter: patrykkotlowski@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;=20 conf =3D newconf; parser =3D 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 =3D uclparse_toplevel(ucl_parser_get_object(parser)); return (error); } ucl_parser pointer is never freed.=20 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;=20 conf =3D newconf; parser =3D 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 =3D ucl_parser_get_object(parser); error =3D uclparse_toplevel(p_top); ucl_object_unref(p_top); ucl_parser_free(parser); return (error); } --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-246596-227>