X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fliboconfig%2Foconfig.c;h=56ccefbf4e26e0e51f77c74f77e376f395db8ef8;hb=16fde0c303ae0afb7c945a78341c09df27c5cdbc;hp=629775ab8c44dd55de5d930d0189168546d455c3;hpb=76a7816d2c066f2feff5c77e7da58df4dbc982c2;p=collectd.git diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index 629775ab..56ccefbf 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; @@ -187,7 +188,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) +void oconfig_free_all (oconfig_item_t *ci) { int i; @@ -206,12 +207,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 */