Module Name: src
Committed By: tteras
Date: Mon Apr 20 13:27:12 UTC 2009
Modified Files:
src/crypto/dist/ipsec-tools/src/racoon [ipsec-tools-0_7-branch]:
nattraversal.c
Log Message:
Fix a memory leak in nat-t keepalive code.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.6.1 \
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.6 src/crypto/dist/ipsec-tools/src/racoon/nattraversal.c:1.6.6.1
--- src/crypto/dist/ipsec-tools/src/racoon/nattraversal.c:1.6 Sat Sep 9 16:22:09 2006
+++ src/crypto/dist/ipsec-tools/src/racoon/nattraversal.c Mon Apr 20 13:27:12 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: nattraversal.c,v 1.6 2006/09/09 16:22:09 manu Exp $ */
+/* $NetBSD: nattraversal.c,v 1.6.6.1 2009/04/20 13:27:12 tteras Exp $ */
/*
* Copyright (C) 2004 SuSE Linux AG, Nuernberg, Germany.
@@ -319,6 +319,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 (void *param)
@@ -333,8 +342,7 @@
s = getsockmyaddr(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",
@@ -435,8 +443,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... */