Author: markj
Date: Sat May 30 19:11:41 2020
New Revision: 361654
URL: https://svnweb.freebsd.org/changeset/base/361654

Log:
  ctld: Fix a memory leak in uclparse_conf().
  
  PR:           246596
  Submitted by: Patryk <patrykkotlow...@gmail.com>
  MFC after:    1 week

Modified:
  head/usr.sbin/ctld/uclparse.c

Modified: head/usr.sbin/ctld/uclparse.c
==============================================================================
--- head/usr.sbin/ctld/uclparse.c       Sat May 30 18:01:53 2020        
(r361653)
+++ head/usr.sbin/ctld/uclparse.c       Sat May 30 19:11:41 2020        
(r361654)
@@ -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);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to