[corosync] [PATCH 5/7] LOG: cleanup logging resources at exit

Angus Salkeld asalkeld at redhat.com
Thu Nov 10 10:54:54 GMT 2011


Signed-off-by: Angus Salkeld <asalkeld at redhat.com>
---
 exec/logsys.c                    |   14 ++++++++++++++
 exec/main.c                      |    2 ++
 include/corosync/engine/logsys.h |    2 ++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/exec/logsys.c b/exec/logsys.c
index d92a2e3..158bf1a 100644
--- a/exec/logsys.c
+++ b/exec/logsys.c
@@ -243,6 +243,20 @@ static const char *_logsys_tags_stringify(uint32_t tags)
 	}
 }
 
+void logsys_system_fini (void)
+{
+	int i;
+	int f;
+	for (i = 0; i < LOGSYS_MAX_SUBSYS_COUNT; i++) {
+		free(logsys_loggers[i].logfile);
+		for (f = 0; i < logsys_loggers[i].file_idx; f++) {
+			free(logsys_loggers[i].files[f]);
+		}
+	}
+
+	qb_log_fini ();
+}
+
 /*
  * Internal API - exported
  */
diff --git a/exec/main.c b/exec/main.c
index 444e59c..957634e 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1648,6 +1648,8 @@ int main (int argc, char **argv, char **envp)
 	 */
 	qb_loop_destroy (corosync_poll_handle);
 
+	logsys_system_fini ();
+
 	/*
 	 * Remove pid lock file
 	 */
diff --git a/include/corosync/engine/logsys.h b/include/corosync/engine/logsys.h
index cfd8a89..247881e 100644
--- a/include/corosync/engine/logsys.h
+++ b/include/corosync/engine/logsys.h
@@ -157,6 +157,8 @@ extern int _logsys_system_setup(
 	int syslog_facility,
 	int syslog_priority);
 
+extern void logsys_system_fini (void);
+
 extern int _logsys_config_subsys_get (
 	const char *subsys);
 
-- 
1.7.7



More information about the discuss mailing list