summaryrefslogtreecommitdiff
path: root/sbin/ipsecctl/ipsecctl.c
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2006-06-01 16:41:39 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2006-06-01 16:41:39 +0000
commit4389062e76e5509bae24bfd6c14a1700801ab5f4 (patch)
tree9ae85d99b308855963393352ba158bd4f423c776 /sbin/ipsecctl/ipsecctl.c
parent3c68a9444484757eea0ad05e7e0ab7ee61da79f7 (diff)
more to free, needed for SA grouping.
Diffstat (limited to 'sbin/ipsecctl/ipsecctl.c')
-rw-r--r--sbin/ipsecctl/ipsecctl.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sbin/ipsecctl/ipsecctl.c b/sbin/ipsecctl/ipsecctl.c
index 1224bddb983..4271e7faaba 100644
--- a/sbin/ipsecctl/ipsecctl.c
+++ b/sbin/ipsecctl/ipsecctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsecctl.c,v 1.52 2006/06/01 16:13:01 markus Exp $ */
+/* $OpenBSD: ipsecctl.c,v 1.53 2006/06/01 16:41:38 hshoexer Exp $ */
/*
* Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
*
@@ -185,12 +185,18 @@ ipsecctl_add_rule(struct ipsecctl *ipsec, struct ipsec_rule *r)
void
ipsecctl_free_rule(struct ipsec_rule *rp)
{
- /* src and dst are always used. */
- free(rp->src->name);
- free(rp->src);
- free(rp->dst->name);
- free(rp->dst);
-
+ if (rp->src) {
+ free(rp->src->name);
+ free(rp->src);
+ }
+ if (rp->dst) {
+ free(rp->dst->name);
+ free(rp->dst);
+ }
+ if (rp->dst2) {
+ free(rp->dst2->name);
+ free(rp->dst2);
+ }
if (rp->local) {
free(rp->local->name);
free(rp->local);