X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fliboconfig%2Foconfig.c;h=db9285b3cf47052581405dcfce2d69170d0c587f;hb=6ba3ecd88fec2fa10b698b2a91eea2e5cc9ef027;hp=f8d18499d6caacb5eba0524a82ccef4767e9b2e0;hpb=dc80c73c20ef0e69c3850fd9679a827ad79e61a1;p=collectd.git diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index f8d18499..db9285b3 100644 --- a/src/liboconfig/oconfig.c +++ b/src/liboconfig/oconfig.c @@ -24,11 +24,15 @@ #include "oconfig.h" -/* Functions provided by the scanner */ -void yyset_in (FILE *); +extern FILE *yyin; oconfig_item_t *ci_root; +static void yyset_in (FILE *fd) +{ + yyin = fd; +} /* void yyset_in */ + oconfig_item_t *oconfig_parse_fh (FILE *fh) { int status; @@ -72,11 +76,25 @@ void oconfig_free (oconfig_item_t *ci) { int i; + if (ci == NULL) + return; + + if (ci->key != NULL) + free (ci->key); + + for (i = 0; i < ci->values_num; i++) + if ((ci->values[i].type == OCONFIG_TYPE_STRING) + && (NULL != ci->values[i].value.string)) + free (ci->values[i].value.string); + if (ci->values != NULL) free (ci->values); for (i = 0; i < ci->children_num; i++) oconfig_free (ci->children + i); + + if (ci->children != NULL) + free (ci->children); } /*