Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/dist/ipsec-tools/src/racoon free spspec when deleting...



details:   https://anonhg.NetBSD.org/src/rev/d4d614f1c19c
branches:  trunk
changeset: 762835:d4d614f1c19c
user:      vanhu <vanhu%NetBSD.org@localhost>
date:      Wed Mar 02 14:58:27 2011 +0000

description:
free spspec when deleting a rmconf struct. patch by Roman Hoog Antink <rha%open.ch@localhost>

diffstat:

 crypto/dist/ipsec-tools/src/racoon/cfparse.y    |  22 +++++++++++++++++++++-
 crypto/dist/ipsec-tools/src/racoon/remoteconf.c |   3 ++-
 crypto/dist/ipsec-tools/src/racoon/remoteconf.h |   3 ++-
 3 files changed, 25 insertions(+), 3 deletions(-)

diffs (77 lines):

diff -r 54fd2dcbe594 -r d4d614f1c19c crypto/dist/ipsec-tools/src/racoon/cfparse.y
--- a/crypto/dist/ipsec-tools/src/racoon/cfparse.y      Wed Mar 02 14:52:32 2011 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/cfparse.y      Wed Mar 02 14:58:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cfparse.y,v 1.40 2011/03/02 14:49:21 vanhu Exp $       */
+/*     $NetBSD: cfparse.y,v 1.41 2011/03/02 14:58:27 vanhu Exp $       */
 
 /* Id: cfparse.y,v 1.66 2006/08/22 18:17:17 manubsd Exp */
 
@@ -145,6 +145,7 @@
 
 static struct secprotospec *newspspec __P((void));
 static void insspspec __P((struct remoteconf *, struct secprotospec *));
+void flushspspec __P((struct remoteconf *));
 static void adminsock_conf __P((vchar_t *, vchar_t *, vchar_t *, int));
 
 static int set_isakmp_proposal __P((struct remoteconf *));
@@ -2414,6 +2415,25 @@
        rmconf->spspec = spspec;
 }
 
+/*
+ * delete the whole list
+ */
+void
+flushspspec(rmconf)
+       struct remoteconf *rmconf;
+{
+       struct secprotospec *p;
+
+       while(rmconf->spspec != NULL) {
+               p = rmconf->spspec;
+               rmconf->spspec = p->next;
+               if (p->next != NULL)
+                       p->next->prev = NULL; /* not necessary but clean */
+
+               racoon_free(p);           
+       }
+}
+
 /* set final acceptable proposal */
 static int
 set_isakmp_proposal(rmconf)
diff -r 54fd2dcbe594 -r d4d614f1c19c crypto/dist/ipsec-tools/src/racoon/remoteconf.c
--- a/crypto/dist/ipsec-tools/src/racoon/remoteconf.c   Wed Mar 02 14:52:32 2011 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/remoteconf.c   Wed Mar 02 14:58:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: remoteconf.c,v 1.23 2011/03/02 14:52:32 vanhu Exp $    */
+/*     $NetBSD: remoteconf.c,v 1.24 2011/03/02 14:58:27 vanhu Exp $    */
 
 /* Id: remoteconf.c,v 1.38 2006/05/06 15:52:44 manubsd Exp */
 
@@ -654,6 +654,7 @@
                racoon_free(rmconf->name);
        if (rmconf->remote)
                racoon_free(rmconf->remote);
+       flushspspec(rmconf);
        racoon_free(rmconf);
 }
 
diff -r 54fd2dcbe594 -r d4d614f1c19c crypto/dist/ipsec-tools/src/racoon/remoteconf.h
--- a/crypto/dist/ipsec-tools/src/racoon/remoteconf.h   Wed Mar 02 14:52:32 2011 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/remoteconf.h   Wed Mar 02 14:58:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: remoteconf.h,v 1.14 2011/02/02 15:21:34 vanhu Exp $    */
+/*     $NetBSD: remoteconf.h,v 1.15 2011/03/02 14:58:27 vanhu Exp $    */
 
 /* Id: remoteconf.h,v 1.26 2006/05/06 15:52:44 manubsd Exp */
 
@@ -208,6 +208,7 @@
 extern void insrmconf __P((struct remoteconf *));
 extern void remrmconf __P((struct remoteconf *));
 extern void flushrmconf __P((void));
+extern void flushspspec __P((struct remoteconf *));
 extern void initrmconf __P((void));
 extern void rmconf_start_reload __P((void));
 extern void rmconf_finish_reload __P((void));



Home | Main Index | Thread Index | Old Index