summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-06-21 00:27:37 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2009-06-21 00:27:37 +0200
commitbcb91373d0641c1999d48526411fd857d2baee28 (patch)
tree689cdc778929bb1005112eba88c235581c814bc1
parent90bb19b9eb7d97887883ce480bb4eb12c60d3505 (diff)
conntrackd: fix memory leak in cache_update_force()
This patch fixes a memory leak in cache_update_force(). The problem occurs if the object does not exists in the cache and we fail to add it. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cache.c b/src/cache.c
index e4a024b..1e544a2 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -340,8 +340,10 @@ cache_update_force(struct cache *c, struct nf_conntrack *ct)
if (obj == NULL)
return NULL;
- if (cache_add(c, obj, id) == -1)
+ if (cache_add(c, obj, id) == -1) {
+ cache_object_free(obj);
return NULL;
+ }
return obj;
}