Check-in Number:
|
2244 | |
Date: |
2002-Jul-05 17:32:42 (local)
2002-Jul-05 15:32:42 (UTC) |
User: | rse |
Branch: | |
Comment: |
thanks to Dmalloc we can fix the memory holes |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/cfg/Makefile 1.4 -> 1.5
--- 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)
|
|
ossp-pkg/cfg/cfg.h 1.3 -> 1.4
--- 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 <dmalloc.h>
+#endif
#include <stdarg.h>
/* ============================================================ */
|
|
ossp-pkg/cfg/cfg_node.c 1.3 -> 1.4
--- 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;
}
|
|
ossp-pkg/cfg/cfg_syn.c 1.4 -> 1.5
--- 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;
+}
+
|
|
ossp-pkg/cfg/cfg_syn.h 1.2 -> 1.3
--- 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, ...);
|
|
ossp-pkg/cfg/cfg_test.c 1.2 -> 1.3
--- 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);
}
|
|