diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-09-19 04:23:14 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-09-19 04:23:14 +0000 |
commit | 00b17a6f5dcfde0d22a01005fc9ac67939e8fe6a (patch) | |
tree | f24fdc94886d863db458d12258e0f59d16fab4b6 /sys/net | |
parent | 1bc49feb9d0b14608e89e8d31800a6b17dcfc4f9 (diff) |
Still more careful with cleaning up.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/pfkeyv2.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index 536ec44dd7a..b3dfdd3ee20 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.40 2000/09/19 03:41:11 angelos Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.41 2000/09/19 04:23:13 angelos Exp $ */ /* %%% copyright-nrl-97 This software is Copyright 1997-1998 by Randall Atkinson, Ronald Lee, @@ -1418,7 +1418,7 @@ pfkeyv2_send(struct socket *socket, void *message, int len) u_int8_t transproto = 0; u_int8_t direction; int exists = 0; - struct tdb *ktdb; + struct tdb *ktdb = NULL; direction = (((struct sadb_protocol *) headers[SADB_X_EXT_FLOW_TYPE])->sadb_protocol_direction); if ((direction != IPSP_DIRECTION_IN) && @@ -1611,7 +1611,8 @@ pfkeyv2_send(struct socket *socket, void *message, int len) { if (!exists) FREE(ipo, M_TDB); - ipo->ipo_tdb = ktdb; /* Reset */ + else + ipo->ipo_tdb = ktdb; /* Reset */ rval = ESRCH; goto splxret; } @@ -1655,6 +1656,17 @@ pfkeyv2_send(struct socket *socket, void *message, int len) default: if (!exists) FREE(ipo, M_TDB); + else + { + if (ipo->ipo_tdb) + TAILQ_REMOVE(&ipo->ipo_tdb->tdb_policy_head, ipo, + ipo_tdb_next); + if (ktdb) + TAILQ_INSERT_HEAD(&ktdb->tdb_policy_head, + ipo, ipo_tdb_next); + ipo->ipo_tdb = ktdb; + } + rval = EINVAL; goto ret; } |