[corosync] [PATCH] LOG: cleanup logging resources at exit

Angus Salkeld asalkeld at redhat.com
Thu Nov 10 21:31:13 GMT 2011


Signed-off-by: Angus Salkeld <asalkeld at redhat.com>
---
 exec/logsys.c                    |   14 ++++++++++++++
 exec/util.c                      |    2 +-
 include/corosync/engine/logsys.h |    2 ++
 3 files changed, 17 insertions(+), 1 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/util.c b/exec/util.c
index 064bee2..848a080 100644
--- a/exec/util.c
+++ b/exec/util.c
@@ -147,7 +147,7 @@ void _corosync_exit_error (
 		log_printf (LOGSYS_LEVEL_ERROR, "Corosync Cluster Engine exiting "
 			"with status %d at %s:%u.\n", err, file, line);
 	}
-	qb_log_fini();
+	logsys_system_fini ();
 	exit (err);
 }
 
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