diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-05-20 14:36:56 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-05-20 14:36:56 +0000 |
commit | a5624f2cf83218e1f61fc8e0c3fee211539e6c6a (patch) | |
tree | 4f92f0925da5745c7b6d35932e5db9025ccd9051 | |
parent | bc25feea06c53f00f0d6f4c0cc46d680abef8057 (diff) |
replace a TAILQ_FOREACH loop with a TAILQ_FIRST loop when releasing entries
of the tailq, this is how it must be done.
-rw-r--r-- | usr.sbin/smtpd/lka.c | 10 | ||||
-rw-r--r-- | usr.sbin/smtpd/mfa.c | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index 640e37560b2..9e8b19952a6 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.48 2009/05/20 14:29:44 gilles Exp $ */ +/* $OpenBSD: lka.c,v 1.49 2009/05/20 14:36:55 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -190,9 +190,10 @@ lka_dispatch_parent(int sig, short event, void *p) temp = env->sc_maps; env->sc_maps = env->sc_maps_reload; env->sc_maps_reload = temp; - + if (env->sc_rules_reload) { - TAILQ_FOREACH(r, env->sc_rules_reload, r_entry) { + while ((r = TAILQ_FIRST(env->sc_rules_reload))) { + TAILQ_REMOVE(env->sc_rules_reload, r, r_entry); free(r); } free(env->sc_rules_reload); @@ -200,7 +201,8 @@ lka_dispatch_parent(int sig, short event, void *p) } if (env->sc_maps_reload) { - TAILQ_FOREACH(m, env->sc_maps_reload, m_entry) { + while ((m = TAILQ_FIRST(env->sc_maps_reload))) { + TAILQ_REMOVE(env->sc_maps_reload, m, m_entry); free(m); } free(env->sc_maps_reload); diff --git a/usr.sbin/smtpd/mfa.c b/usr.sbin/smtpd/mfa.c index b88d4d0f746..8f74d840fa7 100644 --- a/usr.sbin/smtpd/mfa.c +++ b/usr.sbin/smtpd/mfa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfa.c,v 1.27 2009/05/20 14:29:44 gilles Exp $ */ +/* $OpenBSD: mfa.c,v 1.28 2009/05/20 14:36:55 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -166,7 +166,8 @@ mfa_dispatch_parent(int sig, short event, void *p) env->sc_maps_reload = temp; if (env->sc_rules_reload) { - TAILQ_FOREACH(r, env->sc_rules_reload, r_entry) { + while ((r = TAILQ_FIRST(env->sc_rules_reload))) { + TAILQ_REMOVE(env->sc_rules_reload, r, r_entry); free(r); } free(env->sc_rules_reload); @@ -174,7 +175,8 @@ mfa_dispatch_parent(int sig, short event, void *p) } if (env->sc_maps_reload) { - TAILQ_FOREACH(m, env->sc_maps_reload, m_entry) { + while ((m = TAILQ_FIRST(env->sc_maps_reload))) { + TAILQ_REMOVE(env->sc_maps_reload, m, m_entry); free(m); } free(env->sc_maps_reload); |