diff --git a/src/node.c b/src/node.c index aa459cd..33de25d 100644 --- a/src/node.c +++ b/src/node.c @@ -76,12 +76,12 @@ void r3_tree_free(node * tree) { if (tree->routes) { zfree(tree->routes); } - /* - if (tree->pcre_pattern) - zfree(tree->pcre_pattern); - if (tree->pcre_extra) - zfree(tree->pcre_extra); - */ + if (tree->pcre_pattern) { + pcre_free(tree->pcre_pattern); + } + if (n->pcre_extra) { + pcre_free_study(n->pcre_extra); + } if (tree->combined_pattern) zfree(tree->combined_pattern); if (tree->ov) @@ -205,14 +205,12 @@ void r3_tree_compile_patterns(node * n) { int erroffset; unsigned int option_bits = 0; - /* - if (n->pcre_pattern) - zfree(n->pcre_pattern); - if (n->pcre_extra) - zfree(n->pcre_extra); - */ - - // n->pcre_pattern; + if (tree->pcre_pattern) { + pcre_free(tree->pcre_pattern); + } + if (n->pcre_extra) { + pcre_free_study(n->pcre_extra); + } n->pcre_pattern = pcre_compile( n->combined_pattern, /* the pattern */ option_bits, /* default options */