From e4981c4d5c53624b7b5d795f64efe4e8a1e92b40 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 22 Apr 2007 02:27:12 +0000 Subject: [PATCH] fix re cleanup --- src/sigar_ptql.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sigar_ptql.c b/src/sigar_ptql.c index 9f7db3ca..f5262514 100644 --- a/src/sigar_ptql.c +++ b/src/sigar_ptql.c @@ -157,6 +157,9 @@ typedef struct { struct sigar_ptql_query_t { ptql_branch_list_t branches; +#ifdef PTQL_DEBUG + char *ptql; +#endif }; /* XXX optimize */ @@ -1143,9 +1146,6 @@ static int ptql_branch_add(ptql_parse_branch_t *parsed, is_set = 1; branch->value.ptr = re; branch->value_free = pcre_free; -#else - branch->value.ptr = NULL; - branch->value_free = NULL; #endif } @@ -1217,6 +1217,10 @@ SIGAR_DECLARE(int) sigar_ptql_query_create(sigar_ptql_query_t **queryp, sigar_ptql_query_t *query = *queryp = malloc(sizeof(*query)); +#ifdef PTQL_DEBUG + query->ptql = strdup(ptql); +#endif + ptql = ptql_copy; ptql_branch_list_create(&query->branches); @@ -1270,6 +1274,9 @@ SIGAR_DECLARE(int) sigar_ptql_query_create(sigar_ptql_query_t **queryp, SIGAR_DECLARE(int) sigar_ptql_query_destroy(sigar_ptql_query_t *query) { +#ifdef PTQL_DEBUG + free(query->ptql); +#endif ptql_branch_list_destroy(&query->branches); free(query); return SIGAR_OK;