From 87c79f99b6b2ce6895116c3bf9e5a8d28ff5b322 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 6 Mar 2012 11:58:06 +0100 Subject: pingu: cleanup various structures on shutdown --- pingu_host.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'pingu_host.c') diff --git a/pingu_host.c b/pingu_host.c index 81719a6..be44343 100644 --- a/pingu_host.c +++ b/pingu_host.c @@ -139,3 +139,19 @@ int pingu_host_init(struct ev_loop *loop) return 0; } +void pingu_host_cleanup(void) +{ + struct pingu_host *host, *n; + list_for_each_entry_safe(host, n, &host_list, host_list_entry) { + if (host->host != NULL) + free(host->host); + if (host->label != NULL) + free(host->label); + if (host->up_action != NULL) + free((void *)host->up_action); + if (host->down_action != NULL) + free((void *)host->down_action); + list_del(&host->host_list_entry); + free(host); + } +} -- cgit v1.2.3