summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreric <eric@openbsd.org>2012-09-18 15:35:13 +0000
committereric <eric@openbsd.org>2012-09-18 15:35:13 +0000
commit4bbf671b1c2aaedcb4ca66d51d7e8aef2507b65a (patch)
tree4d229839b504398539afe74940efffe7246ccc95
parentWait until all xfers have finished before giving up DMA buffer mappings. (diff)
downloadwireguard-openbsd-4bbf671b1c2aaedcb4ca66d51d7e8aef2507b65a.tar.xz
wireguard-openbsd-4bbf671b1c2aaedcb4ca66d51d7e8aef2507b65a.zip
make use of expandtree_free_nodes() in lka_session_destroy().
change to a simpler implementation for it while there. ok gilles@
-rw-r--r--usr.sbin/smtpd/expand.c12
-rw-r--r--usr.sbin/smtpd/lka_session.c9
2 files changed, 7 insertions, 14 deletions
diff --git a/usr.sbin/smtpd/expand.c b/usr.sbin/smtpd/expand.c
index 4d0a7e4473f..5f6fd8754bd 100644
--- a/usr.sbin/smtpd/expand.c
+++ b/usr.sbin/smtpd/expand.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: expand.c,v 1.11 2010/11/28 14:35:58 gilles Exp $ */
+/* $OpenBSD: expand.c,v 1.12 2012/09/18 15:35:13 eric Exp $ */
/*
* Copyright (c) 2009 Gilles Chehade <gilles@openbsd.org>
@@ -84,13 +84,11 @@ expandtree_remove_node(struct expandtree *expandtree, struct expandnode *node)
void
expandtree_free_nodes(struct expandtree *expandtree)
{
- struct expandnode *p;
- struct expandnode *nxt;
+ struct expandnode *xn;
- for (p = RB_MIN(expandtree, expandtree); p != NULL; p = nxt) {
- nxt = RB_NEXT(expandtree, expandtree, p);
- RB_REMOVE(expandtree, expandtree, p);
- free(p);
+ while ((xn = RB_ROOT(expandtree)) != NULL) {
+ RB_REMOVE(expandtree, expandtree, xn);
+ free(xn);
}
}
diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c
index ebfb374d512..eebee6052e1 100644
--- a/usr.sbin/smtpd/lka_session.c
+++ b/usr.sbin/smtpd/lka_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka_session.c,v 1.26 2012/09/18 14:23:01 eric Exp $ */
+/* $OpenBSD: lka_session.c,v 1.27 2012/09/18 15:35:13 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -321,18 +321,13 @@ static void
lka_session_destroy(struct lka_session *lks)
{
struct envelope *ep;
- struct expandnode *xn;
while ((ep = TAILQ_FIRST(&lks->deliverylist)) != NULL) {
TAILQ_REMOVE(&lks->deliverylist, ep, entry);
free(ep);
}
- while ((xn = RB_ROOT(&lks->expandtree)) != NULL) {
- RB_REMOVE(expandtree, &lks->expandtree, xn);
- free(xn);
- }
-
+ expandtree_free_nodes(&lks->expandtree);
tree_xpop(&sessions, lks->id);
free(lks);
}