From bcb91373d0641c1999d48526411fd857d2baee28 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 21 Jun 2009 00:27:37 +0200 Subject: 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 --- src/cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3