[conntrack-tools] conntrackd: fix memory leak in cache_update_force()

Pablo Neira netfilter-cvslog-bounces at lists.netfilter.org
Sun Jun 21 00:28:12 CEST 2009


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=conntrack-tools.git;a=commit;h=bcb91373d0641c1999d48526411fd857d2baee28
commit bcb91373d0641c1999d48526411fd857d2baee28
Author:     Pablo Neira Ayuso <pablo at netfilter.org>
AuthorDate: Sun Jun 21 00:27:37 2009 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Sun Jun 21 00:27:37 2009 +0200

    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 at netfilter.org>
       via  bcb91373d0641c1999d48526411fd857d2baee28 (commit)
      from  90bb19b9eb7d97887883ce480bb4eb12c60d3505 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bcb91373d0641c1999d48526411fd857d2baee28
Author: Pablo Neira Ayuso <pablo at netfilter.org>
Date:   Sun Jun 21 00:27:37 2009 +0200

    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 at netfilter.org>

-----------------------------------------------------------------------

 src/cache.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
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 at netfilter.org>

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;
 }



More information about the netfilter-cvslog mailing list