there is already a pointer guard in zmalloc

This commit is contained in:
c9s 2014-05-23 11:15:57 +08:00
parent c841de166c
commit 59e6997959
2 changed files with 6 additions and 14 deletions

View file

@ -80,9 +80,7 @@ node * r3_edge_branch(edge *e, int dl) {
} }
void r3_edge_free(edge * e) { void r3_edge_free(edge * e) {
if (e->pattern) { zfree(e->pattern);
zfree(e->pattern);
}
if ( e->child ) { if ( e->child ) {
r3_tree_free(e->child); r3_tree_free(e->child);
} }

View file

@ -70,12 +70,9 @@ void r3_tree_free(node * tree) {
r3_edge_free(tree->edges[ i ]); r3_edge_free(tree->edges[ i ]);
} }
} }
if (tree->edges) { zfree(tree->edges);
zfree(tree->edges); zfree(tree->routes);
}
if (tree->routes) {
zfree(tree->routes);
}
if (tree->pcre_pattern) { if (tree->pcre_pattern) {
pcre_free(tree->pcre_pattern); pcre_free(tree->pcre_pattern);
} }
@ -84,11 +81,8 @@ void r3_tree_free(node * tree) {
pcre_free_study(tree->pcre_extra); pcre_free_study(tree->pcre_extra);
} }
#endif #endif
zfree(tree->combined_pattern);
if (tree->combined_pattern) zfree(tree->ov);
zfree(tree->combined_pattern);
if (tree->ov)
zfree(tree->ov);
zfree(tree); zfree(tree);
tree = NULL; tree = NULL;
} }