Module Name:    src
Committed By:   tteras
Date:           Mon Apr 20 13:17:35 UTC 2009

Modified Files:
        src/crypto/dist/ipsec-tools/src/racoon: nattraversal.c

Log Message:
Fix a memory leak in nat-t keepalive code.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
    src/crypto/dist/ipsec-tools/src/racoon/nattraversal.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/nattraversal.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/nattraversal.c:1.9 src/crypto/dist/ipsec-tools/src/racoon/nattraversal.c:1.10
--- src/crypto/dist/ipsec-tools/src/racoon/nattraversal.c:1.9	Thu Mar 12 10:57:26 2009
+++ src/crypto/dist/ipsec-tools/src/racoon/nattraversal.c	Mon Apr 20 13:17:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: nattraversal.c,v 1.9 2009/03/12 10:57:26 tteras Exp $	*/
+/*	$NetBSD: nattraversal.c,v 1.10 2009/04/20 13:17:35 tteras Exp $	*/
 
 /*
  * Copyright (C) 2004 SuSE Linux AG, Nuernberg, Germany.
@@ -325,6 +325,15 @@
       iph1->natt_flags |= NAT_ANNOUNCED;
 }
 
+static void
+natt_keepalive_delete (struct natt_ka_addrs *ka)
+{
+  TAILQ_REMOVE (&ka_tree, ka, chain);
+  racoon_free (ka->src);
+  racoon_free (ka->dst);
+  racoon_free (ka);
+}
+
 /* NAT keepalive functions */
 static void
 natt_keepalive_send (struct sched *param)
@@ -339,8 +348,7 @@
     
     s = myaddr_getfd(ka->src);
     if (s == -1) {
-      TAILQ_REMOVE (&ka_tree, ka, chain);
-      racoon_free (ka);
+      natt_keepalive_delete(ka);
       continue;
     }
     plog (LLV_DEBUG, LOCATION, NULL, "KA: %s\n", 
@@ -441,8 +449,7 @@
 
       plog (LLV_DEBUG, LOCATION, NULL, "KA removing this one...\n");
 
-      TAILQ_REMOVE (&ka_tree, ka, chain);
-      racoon_free (ka);
+      natt_keepalive_delete (ka);
       /* Should we break here? Every pair of addresses should 
          be inserted only once, but who knows :-) Lets traverse 
 	 the whole list... */

Reply via email to