diff options
author | Mark Johnston <markj@FreeBSD.org> | 2020-05-30 19:11:41 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2020-05-30 19:11:41 +0000 |
commit | dd8b877e6a80a474f3b7cc829ee2cac4f6e435d9 (patch) | |
tree | aa3aa003c41b532661cca901f0714ad309bb0a16 /usr.sbin/ctld | |
parent | 694034e2276caaa5ebdf2c707cd407cd0f005309 (diff) | |
download | src-test2-dd8b877e6a80a474f3b7cc829ee2cac4f6e435d9.tar.gz src-test2-dd8b877e6a80a474f3b7cc829ee2cac4f6e435d9.zip |
ctld: Fix a memory leak in uclparse_conf().
PR: 246596
Submitted by: Patryk <patrykkotlowski@gmail.com>
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=361654
Diffstat (limited to 'usr.sbin/ctld')
-rw-r--r-- | usr.sbin/ctld/uclparse.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c index 3d39da42569e..0652d2b4c684 100644 --- a/usr.sbin/ctld/uclparse.c +++ b/usr.sbin/ctld/uclparse.c @@ -914,6 +914,7 @@ int uclparse_conf(struct conf *newconf, const char *path) { struct ucl_parser *parser; + ucl_object_t *top; int error; conf = newconf; @@ -922,10 +923,14 @@ uclparse_conf(struct conf *newconf, const char *path) if (!ucl_parser_add_file(parser, path)) { log_warn("unable to parse configuration file %s: %s", path, ucl_parser_get_error(parser)); + ucl_parser_free(parser); return (1); } - error = uclparse_toplevel(ucl_parser_get_object(parser)); + top = ucl_parser_get_object(parser); + error = uclparse_toplevel(top); + ucl_object_unref(top); + ucl_parser_free(parser); return (error); } |