diff options
author | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2012-01-22 11:20:42 +0000 |
---|---|---|
committer | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2012-01-22 11:20:42 +0000 |
commit | 4ed472a1cc868dd4efdb533a1620a6c533367c22 (patch) | |
tree | 065380bec9dc8ec1b1b46d467d3c185307fc4b42 /sbin | |
parent | e0c980d95d4965972eafd5d0bc711a79c0fe391f (diff) | |
download | src-4ed472a1cc868dd4efdb533a1620a6c533367c22.tar.gz src-4ed472a1cc868dd4efdb533a1620a6c533367c22.zip |
Notes
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/hastd/hastd.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c index 945f4dcb21b5..e3b946c7569e 100644 --- a/sbin/hastd/hastd.c +++ b/sbin/hastd/hastd.c @@ -99,10 +99,10 @@ g_gate_load(void) void descriptors_cleanup(struct hast_resource *res) { - struct hast_resource *tres; + struct hast_resource *tres, *tmres; struct hastd_listen *lst; - TAILQ_FOREACH(tres, &cfg->hc_resources, hr_next) { + TAILQ_FOREACH_SAFE(tres, &cfg->hc_resources, hr_next, tmres) { if (tres == res) { PJDLOG_VERIFY(res->hr_role == HAST_ROLE_SECONDARY || (res->hr_remotein == NULL && @@ -119,13 +119,17 @@ descriptors_cleanup(struct hast_resource *res) proto_close(tres->hr_event); if (tres->hr_conn != NULL) proto_close(tres->hr_conn); + TAILQ_REMOVE(&cfg->hc_resources, tres, hr_next); + free(tres); } if (cfg->hc_controlin != NULL) proto_close(cfg->hc_controlin); proto_close(cfg->hc_controlconn); - TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) { + while ((lst = TAILQ_FIRST(&cfg->hc_listen)) != NULL) { + TAILQ_REMOVE(&cfg->hc_listen, lst, hl_next); if (lst->hl_conn != NULL) proto_close(lst->hl_conn); + free(lst); } (void)pidfile_close(pfh); hook_fini(); |