diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-04-12 09:11:17 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-04-12 09:11:17 +0200 |
commit | 048f8816f6bea585b092b528b9da648a32a9c94c (patch) | |
tree | d8eddece56f7c6b2168ade3a02607cefdaf8a86b | |
parent | d8c2a736d5741daf0d70511d49f30e24fe0203d9 (diff) |
Memory allocation bug fixed in prefix filter
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r-- | src/prefix_filter.cpp | 6 |
1 files 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_, |