[icinga-checkins] icinga.org: icinga-core/next: * core: Plug some macro leaks triggered when sending notifications ( Andreas Ericsson) #2109

git at icinga.org git at icinga.org
Sun Feb 5 14:12:44 CET 2012


Module: icinga-core
Branch: next
Commit: 2dbd96b57c34cf02da834208e827162c900314a0
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=2dbd96b57c34cf02da834208e827162c900314a0

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Fri Jan 27 12:44:24 2012 +0100

* core: Plug some macro leaks triggered when sending notifications (Andreas Ericsson) #2109

refs #2109

---

 Changelog            |    1 +
 base/notifications.c |   24 +++++++++++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index b8db6eb..994df89 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@ Thanks to all contributers, testers and developers. Please read AUTHORS and THAN
 ENHANCEMENTS
 
 FIXES
+* core: Plug some macro leaks triggered when sending notifications (Andreas Ericsson) #2109
 * install: Fix notification template installation (Todd Zullinger) #2235
 
 CHANGES
diff --git a/base/notifications.c b/base/notifications.c
index 468770c..722228b 100644
--- a/base/notifications.c
+++ b/base/notifications.c
@@ -281,8 +281,17 @@ int service_notification(service *svc, int type, char *not_author, char *not_dat
                 /* this gets set in add_notification() */
                 my_free(mac.x[MACRO_NOTIFICATIONRECIPIENTS]);
 
-		/* clear summary macros so they will be regenerated without contact filters when needed next */
-		clear_summary_macros_r(&mac);
+                /*
+                 * Clear all macros customized per contact that will
+                 * otherwise linger in memory now that we're done with
+                 * the notifications.
+                 */
+                clear_summary_macros_r(&mac);
+                clear_contact_macros_r(&mac);
+                clear_argv_macros_r(&mac);
+
+                /* this gets set in create_notification_list_from_service() */
+                my_free(mac.x[MACRO_NOTIFICATIONISESCALATED]);
 
 		if (type == NOTIFICATION_NORMAL) {
 
@@ -1453,8 +1462,17 @@ int host_notification(host *hst, int type, char *not_author, char *not_data, int
 		/* this gets set in add_notification() */
 		my_free(mac.x[MACRO_NOTIFICATIONRECIPIENTS]);
 
-		/* clear summary macros so they will be regenerated without contact filters when needednext */
+		/*
+		 * Clear all macros customized per contact that will
+		 * otherwise linger in memory now that we're done with
+		 * the notifications.
+		 */
 		clear_summary_macros_r(&mac);
+		clear_contact_macros_r(&mac);
+		clear_argv_macros_r(&mac);
+
+		/* this gets set in create_notification_list_from_service() */
+		my_free(mac.x[MACRO_NOTIFICATIONISESCALATED]);
 
 		if (type == NOTIFICATION_NORMAL) {
 





More information about the icinga-checkins mailing list