free slug object

This commit is contained in:
c9s 2014-08-12 18:02:48 +08:00
parent 21dcdd5807
commit bd22e7b35c

View file

@ -72,7 +72,6 @@ void r3_tree_free(node * tree) {
} }
zfree(tree->edges); zfree(tree->edges);
zfree(tree->routes); zfree(tree->routes);
if (tree->pcre_pattern) { if (tree->pcre_pattern) {
pcre_free(tree->pcre_pattern); pcre_free(tree->pcre_pattern);
} }
@ -570,12 +569,15 @@ edge * r3_node_find_common_prefix(node *n, const char *path, int path_len, int *
break; break;
} }
} else if (ret == -1) { } else if (ret == -1) {
r3_slug_free(slug);
return NULL; return NULL;
} else { } else {
break; break;
} }
} while(ret == 1); } while(ret == 1);
// free the slug
r3_slug_free(slug);
} }
*prefix_len = prefix; *prefix_len = prefix;