summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-04-12 09:11:17 +0200
committerMartin Sustrik <sustrik@250bpm.com>2012-04-12 09:11:17 +0200
commit048f8816f6bea585b092b528b9da648a32a9c94c (patch)
treed8eddece56f7c6b2168ade3a02607cefdaf8a86b
parentd8c2a736d5741daf0d70511d49f30e24fe0203d9 (diff)
Memory allocation bug fixed in prefix filter
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r--src/prefix_filter.cpp6
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_,