summaryrefslogtreecommitdiff
path: root/sys/net/pfkeyv2_convert.c
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2015-05-25 18:48:18 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2015-05-25 18:48:18 +0000
commitdde006bae589633b89c98478738075027e98e827 (patch)
tree6a56538ce3ebd2cb09d3f47c0e7381f6aea52c8d /sys/net/pfkeyv2_convert.c
parent804e1646f4fcd3e40ffa5657ac9037d5c6db06f4 (diff)
fix a panic in import_identities() in case the ID isnt loaded
(triggered by bgpd). ok marku@s, mikeb@
Diffstat (limited to 'sys/net/pfkeyv2_convert.c')
-rw-r--r--sys/net/pfkeyv2_convert.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/net/pfkeyv2_convert.c b/sys/net/pfkeyv2_convert.c
index 946c11a545d..1170a0c6fcb 100644
--- a/sys/net/pfkeyv2_convert.c
+++ b/sys/net/pfkeyv2_convert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2_convert.c,v 1.51 2015/05/23 12:38:53 markus Exp $ */
+/* $OpenBSD: pfkeyv2_convert.c,v 1.52 2015/05/25 18:48:17 benno Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@keromytis.org)
*
@@ -746,8 +746,10 @@ import_identities(struct ipsec_ids **ids, int swapped,
if (*ids == tmp)
return;
}
- free(tmp->id_local, M_CREDENTIALS, 0);
- free(tmp->id_remote, M_CREDENTIALS, 0);
+ if (tmp->id_local != NULL)
+ free(tmp->id_local, M_CREDENTIALS, 0);
+ if (tmp->id_remote != NULL)
+ free(tmp->id_remote, M_CREDENTIALS, 0);
free(tmp, M_CREDENTIALS, 0);
}