X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fliboconfig%2Foconfig.c;h=936e3733d8fb7c3bd8b522ec9bdb7ad38c12ddb0;hb=fbcd4074ba7975612c829f7f473e1645b44f92bc;hp=629775ab8c44dd55de5d930d0189168546d455c3;hpb=330010ea9cf8dad458dc9245d8284a7dbf62b1a9;p=collectd.git diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index 629775ab..936e3733 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) +static 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 */