diff options
author | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2005-04-07 18:52:19 +0000 |
---|---|---|
committer | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2005-04-07 18:52:19 +0000 |
commit | 1a05d088fbe3c9167463637e617621d353c58f10 (patch) | |
tree | 3b141fb7bc3a2731141515fc52cc86078235cda8 /sbin | |
parent | 3b54751f98c2ee81be0c590c9a39c1b6d9fd7d4b (diff) |
Plug memleak.
ok cloder ho markus
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/isakmpd/message.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/isakmpd/message.c b/sbin/isakmpd/message.c index 40c9462f5c0..8798189aec4 100644 --- a/sbin/isakmpd/message.c +++ b/sbin/isakmpd/message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: message.c,v 1.100 2005/04/06 16:00:20 deraadt Exp $ */ +/* $OpenBSD: message.c,v 1.101 2005/04/07 18:52:18 hshoexer Exp $ */ /* $EOM: message.c,v 1.156 2000/10/10 12:36:39 provos Exp $ */ /* @@ -223,7 +223,7 @@ void message_free(struct message *msg) { u_int32_t i; - struct payload *payload, *next; + struct payload *payload; LOG_DBG((LOG_MESSAGE, 20, "message_free: freeing %p", msg)); if (!msg) @@ -239,12 +239,12 @@ message_free(struct message *msg) if (msg->retrans) timer_remove_event(msg->retrans); if (msg->payload) { - for (i = 0; i < payload_index_max; i++) - for (payload = payload_first(msg, i); payload; - payload = next) { - next = TAILQ_NEXT(payload, link); + for (i = 0; i < payload_index_max; i++) { + while ((payload = TAILQ_FIRST(&msg->payload[i]))) { + TAILQ_REMOVE(&msg->payload[i], payload, link); free(payload); } + } free(msg->payload); } while (TAILQ_FIRST(&msg->post_send) != 0) |