From 048f8816f6bea585b092b528b9da648a32a9c94c Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 12 Apr 2012 09:11:17 +0200 Subject: Memory allocation bug fixed in prefix filter Signed-off-by: Martin Sustrik --- src/prefix_filter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/prefix_filter.cpp b/src/prefix_filter.cpp index 9ee18d2..d13c5b4 100644 --- a/src/prefix_filter.cpp +++ b/src/prefix_filter.cpp @@ -468,7 +468,7 @@ static int id (void *core_) static void *pf_create (void *core_) { - pfx_node_t *root = (pfx_node_t*) malloc (sizeof (pfx_node_t*)); + pfx_node_t *root = (pfx_node_t*) malloc (sizeof (pfx_node_t)); alloc_assert (root); pfx_init (root); return (void*) root; @@ -477,6 +477,7 @@ static void *pf_create (void *core_) static void pf_destroy (void *core_, void *pf_) { pfx_close ((pfx_node_t*) pf_); + free (pf_); } static int pf_subscribe (void *core_, void *pf_, void *subscriber_, @@ -546,7 +547,7 @@ static void pf_match (void *core_, void *pf_, static void *sf_create (void *core_) { - pfx_node_t *root = (pfx_node_t*) malloc (sizeof (pfx_node_t*)); + pfx_node_t *root = (pfx_node_t*) malloc (sizeof (pfx_node_t)); alloc_assert (root); pfx_init (root); return (void*) root; @@ -555,6 +556,7 @@ static void *sf_create (void *core_) static void sf_destroy (void *core_, void *sf_) { pfx_close ((pfx_node_t*) sf_); + free (sf_); } static int sf_subscribe (void *core_, void *sf_, -- cgit v1.2.3