Index: ossp-pkg/cfg/cfg_buf.c RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_buf.c,v rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_buf.c,v' 2>/dev/null --- cfg_buf.c 2002/11/18 09:51:29 1.7 +++ cfg_buf.c 2002/11/18 10:23:36 1.8 @@ -125,8 +125,10 @@ { if (buf == NULL) return CFG_ERR_ARG; - if (ptr != NULL) + if (ptr != NULL) { *ptr = buf->buf_ptr; + buf->buf_ptr = NULL; + } if (len != NULL) *len = buf->buf_len; if (size != NULL) Index: ossp-pkg/cfg/cfg_global.h RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_global.h,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_global.h,v' 2>/dev/null --- cfg_global.h 2002/11/18 09:51:29 1.1 +++ cfg_global.h 2002/11/18 10:23:36 1.2 @@ -31,6 +31,8 @@ #ifndef __CFG_GLOBAL_H__ #define __CFG_GLOBAL_H__ +#include "config.h" + #ifdef WITH_DMALLOC #include "dmalloc.h" #endif Index: ossp-pkg/cfg/cfg_main.c RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_main.c,v rcsdiff -q -kk '-r1.8' '-r1.9' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_main.c,v' 2>/dev/null --- cfg_main.c 2002/11/18 09:51:29 1.8 +++ cfg_main.c 2002/11/18 10:23:36 1.9 @@ -77,6 +77,7 @@ { if (cfg == NULL) return CFG_ERR_ARG; + /* FIXME: on each node, free token string first */ cfg_grid_destroy(cfg->grid_nodes); cfg_grid_destroy(cfg->grid_tokens); free(cfg); Index: ossp-pkg/cfg/cfg_test.c RCS File: /v/ossp/cvs/ossp-pkg/cfg/cfg_test.c,v rcsdiff -q -kk '-r1.10' '-r1.11' -u '/v/ossp/cvs/ossp-pkg/cfg/cfg_test.c,v' 2>/dev/null --- cfg_test.c 2002/11/18 09:51:29 1.10 +++ cfg_test.c 2002/11/18 10:23:36 1.11 @@ -42,24 +42,24 @@ cfg_destroy(cfg); exit(1); } + free(im_ptr); if ((rc = cfg_export(cfg, NULL, CFG_FMT_CFG, &ex_ptr, 0)) != CFG_OK) { cfg_error(cfg, rc, &error); fprintf(stderr, "ERROR: cfg_export: %s\n", error); - free(im_ptr); cfg_destroy(cfg); exit(1); } fprintf(stdout, "%s", ex_ptr); fflush(stdout); + free(ex_ptr); if (argc == 3) { if ((rc = cfg_node_select(cfg, NULL, &vec, "%s", argv[2])) != CFG_OK) { cfg_error(cfg, rc, &error); fprintf(stderr, "ERROR: cfg_node_select: %s\n", error); - free(im_ptr); - /*cfg_destroy(cfg);*/ + cfg_destroy(cfg); exit(1); } for (i = 1; vec[i] != NULL; i++) { @@ -67,19 +67,16 @@ if ((rc = cfg_export(cfg, vec[i], CFG_FMT_CFG, &ex_ptr, 0)) != CFG_OK) { cfg_error(cfg, rc, &error); fprintf(stderr, "ERROR: cfg_export: %s\n", error); - free(im_ptr); - /*cfg_destroy(cfg);*/ + cfg_destroy(cfg); exit(1); } fprintf(stdout, "%s", ex_ptr); fprintf(stdout, "---- selection #%d ----\n", i); + free(ex_ptr); } } -#if 0 - cfg_syn_destroy(cfg, node); cfg_destroy(cfg); -#endif return 0; }