X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fliboconfig%2Foconfig.c;h=f422f5adcb905e1d2bb5abed011ba10424c779a6;hb=59547eb66a3743ca0b458222d7a4318f3e659a60;hp=539c9d3533ec5b3a29e5bb32f0227f2e0f4ac910;hpb=de21923bcdbd01827f445eb1f573778b7bfa5202;p=collectd.git diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index 539c9d35..f422f5ad 100644 --- a/src/liboconfig/oconfig.c +++ b/src/liboconfig/oconfig.c @@ -33,6 +33,7 @@ #include "oconfig.h" extern FILE *yyin; +extern int yyparse (void); oconfig_item_t *ci_root; const char *c_file; @@ -195,7 +196,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; @@ -214,12 +215,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 */