Index: ossp-pkg/cfg/Makefile RCS File: /v/ossp/cvs/ossp-pkg/cfg/Attic/Makefile,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/cfg/Attic/Makefile,v' 2>/dev/null --- Makefile 2002/07/04 14:51:21 1.4 +++ Makefile 2002/07/05 15:32:42 1.5 @@ -6,8 +6,11 @@ -Wshadow -Wpointer-arith \ -Wbad-function-cast -Wcast-align \ -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \ - -Wredundant-decls -Wnested-externs -Winline + -Wredundant-decls -Wnested-externs -Winline \ + -DDMALLOCx -I/usr/opkg/include #CFLAGS = -Wundef -W -Wconversion -Wfloat-equal -Wunreachable-code -Wwrite-strings +LDFLAGS = -L/usr/opkg/lib +LIBS = # -ldmalloc AR = ar RANLIB = ranlib RM = rm -f @@ -35,7 +38,7 @@ $(RANLIB) $(LIB) $(TST): $(TST).o $(LIB) - $(CC) -o $(TST) $(TST).o $(LIB) + $(CC) $(LDFLAGS) -o $(TST) $(TST).o $(LIB) $(LIBS) clean: $(RM) $(LIB) Index: ossp-pkg/cfg/cfg.h RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg.h,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg.h,v' 2>/dev/null --- cfg.h 2002/07/04 12:30:08 1.3 +++ cfg.h 2002/07/05 15:32:42 1.4 @@ -31,6 +31,9 @@ #ifndef __CFG_H__ #define __CFG_H__ +#ifdef DMALLOC +#include +#endif #include /* ============================================================ */ Index: ossp-pkg/cfg/cfg_node.c RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_node.c,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_node.c,v' 2>/dev/null --- cfg_node.c 2002/07/04 12:30:08 1.3 +++ cfg_node.c 2002/07/05 15:32:42 1.4 @@ -254,6 +254,8 @@ { if (node == NULL) return CFG_ERR_ARG; + if (node->token != NULL) + free(node->token); free(node); return CFG_OK; } Index: ossp-pkg/cfg/cfg_syn.c RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_syn.c,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_syn.c,v' 2>/dev/null --- cfg_syn.c 2002/07/05 15:21:19 1.4 +++ cfg_syn.c 2002/07/05 15:32:42 1.5 @@ -275,3 +275,23 @@ return CFG_OK; } +static cfg_rc_t cfg_syn_destroy_node(cfg_node_t *node) +{ + if (node == NULL) + return CFG_ERR_ARG; + if (node->child1 != NULL) + cfg_syn_destroy_node(node->child1); + if (node->rbroth != NULL) + cfg_syn_destroy_node(node->rbroth); + cfg_node_destroy(node); + return CFG_OK; +} + +cfg_rc_t cfg_syn_destroy(cfg_t *cfg, cfg_node_t *node) +{ + if (node == NULL) + return CFG_ERR_ARG; + cfg_syn_destroy_node(node); + return CFG_OK; +} + Index: ossp-pkg/cfg/cfg_syn.h RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_syn.h,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_syn.h,v' 2>/dev/null --- cfg_syn.h 2002/07/04 14:51:21 1.2 +++ cfg_syn.h 2002/07/05 15:32:42 1.3 @@ -65,8 +65,9 @@ #define last_column last /* internal API */ -extern cfg_rc_t cfg_syn_import (cfg_t *cfg, cfg_node_t **node, const char *input, char *err_buf, size_t err_len); -extern cfg_rc_t cfg_syn_export (cfg_t *cfg, cfg_node_t *node, char **output); +extern cfg_rc_t cfg_syn_import (cfg_t *cfg, cfg_node_t **node, const char *input, char *err_buf, size_t err_len); +extern cfg_rc_t cfg_syn_export (cfg_t *cfg, cfg_node_t *node, char **output); +extern cfg_rc_t cfg_syn_destroy (cfg_t *cfg, cfg_node_t *node); /* error reporting function */ extern void cfg_syn_error(cfg_syn_ctx_t *ctx, cfg_rc_t rv, YYLTYPE *loc, const char *fmt, ...); Index: ossp-pkg/cfg/cfg_test.c RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_test.c,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_test.c,v' 2>/dev/null --- cfg_test.c 2002/07/04 14:51:21 1.2 +++ cfg_test.c 2002/07/05 15:32:42 1.3 @@ -32,6 +32,7 @@ fprintf(stderr, "ERROR: %s\n", err_buf); else { cfg_syn_export(NULL, node, &buf_ptr); + cfg_syn_destroy(NULL, node); fprintf(stdout, "%s\n", buf_ptr); }