X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fliboconfig%2Foconfig.c;h=bb36c5e66fc5ac8d5b65f135675cc6011b94393c;hb=496ca2b758344bc6372ab0adf98ad8050f69b25a;hp=629775ab8c44dd55de5d930d0189168546d455c3;hpb=0e36ca16a2e53e01cbc08ee9b4b9d26176022786;p=collectd.git diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index 629775ab..bb36c5e6 100644 --- a/src/liboconfig/oconfig.c +++ b/src/liboconfig/oconfig.c @@ -25,6 +25,7 @@ #include "oconfig.h" extern FILE *yyin; +extern int yyparse (void); oconfig_item_t *ci_root; const char *c_file; @@ -44,8 +45,6 @@ oconfig_item_t *oconfig_parse_fh (FILE *fh) yyset_in (fh); if (NULL == c_file) { - int status; - status = snprintf (file, sizeof (file), "", fileno (fh)); if ((status < 0) || (status >= sizeof (file))) { @@ -187,7 +186,7 @@ oconfig_item_t *oconfig_clone (const oconfig_item_t *ci_orig) return (ci_copy); } /* oconfig_item_t *oconfig_clone */ -void oconfig_free (oconfig_item_t *ci) +static void oconfig_free_all (oconfig_item_t *ci) { int i; @@ -206,12 +205,19 @@ void oconfig_free (oconfig_item_t *ci) free (ci->values); for (i = 0; i < ci->children_num; i++) - oconfig_free (ci->children + i); + oconfig_free_all (ci->children + i); if (ci->children != NULL) free (ci->children); } +void oconfig_free (oconfig_item_t *ci) +{ + oconfig_free_all (ci); + free (ci); + ci = NULL; +} + /* * vim:shiftwidth=2:tabstop=8:softtabstop=2:fdm=marker */