fix re cleanup

This commit is contained in:
Doug MacEachern 2007-04-22 02:27:12 +00:00
parent e46b6e8e8a
commit e4981c4d5c
1 changed files with 10 additions and 3 deletions

View File

@ -157,6 +157,9 @@ typedef struct {
struct sigar_ptql_query_t { struct sigar_ptql_query_t {
ptql_branch_list_t branches; ptql_branch_list_t branches;
#ifdef PTQL_DEBUG
char *ptql;
#endif
}; };
/* XXX optimize */ /* XXX optimize */
@ -1143,9 +1146,6 @@ static int ptql_branch_add(ptql_parse_branch_t *parsed,
is_set = 1; is_set = 1;
branch->value.ptr = re; branch->value.ptr = re;
branch->value_free = pcre_free; branch->value_free = pcre_free;
#else
branch->value.ptr = NULL;
branch->value_free = NULL;
#endif #endif
} }
@ -1217,6 +1217,10 @@ SIGAR_DECLARE(int) sigar_ptql_query_create(sigar_ptql_query_t **queryp,
sigar_ptql_query_t *query = sigar_ptql_query_t *query =
*queryp = malloc(sizeof(*query)); *queryp = malloc(sizeof(*query));
#ifdef PTQL_DEBUG
query->ptql = strdup(ptql);
#endif
ptql = ptql_copy; ptql = ptql_copy;
ptql_branch_list_create(&query->branches); 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) 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); ptql_branch_list_destroy(&query->branches);
free(query); free(query);
return SIGAR_OK; return SIGAR_OK;