[icinga-checkins] icinga.org: icinga-core/master: core: fix content of macro $NOTIFICATIONRECIPIENTS$ grows and grows #1695

git at icinga.org git at icinga.org
Thu Aug 25 11:23:25 CEST 2011


Module: icinga-core
Branch: master
Commit: 0cf2d71bc9ae57f26d7aa6312310f50515a4786b
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=0cf2d71bc9ae57f26d7aa6312310f50515a4786b

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Wed Aug 24 15:40:48 2011 +0200

core: fix content of macro $NOTIFICATIONRECIPIENTS$ grows and grows #1695

the macro itsself is never free'd and it's one of those using realloc
and strcat to grow in size. after having sent all notifications, this
macro needs to be free'd. it isn't exactly a memory leak but an
unwanted yet buggy behaviour.

fixes #1695

---

 Changelog            |    1 +
 base/notifications.c |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/Changelog b/Changelog
index 2c63a0b..78c0af2 100644
--- a/Changelog
+++ b/Changelog
@@ -66,6 +66,7 @@ FIXES
 * core: try to avoid a single check being reaped multiple times (Andreas Ericsson) #1652
 * core: Fix typo in configure.in preventing compilation on FreeBSD (thanks sag47) #1732
 * core: plug memory leak with display_name on start/reload #1841
+* core: fix content of macro $NOTIFICATIONRECIPIENTS$ grows and grows #1695
 
 * classic ui: fix cross site scripting vulnerability in config.cgi on config expander arguments #1605
 * classic ui: better handling of writing to cgi.log in cmd.cgi #1161
diff --git a/base/notifications.c b/base/notifications.c
index 247bead..fcafbeb 100644
--- a/base/notifications.c
+++ b/base/notifications.c
@@ -256,6 +256,9 @@ int service_notification(service *svc, int type, char *not_author, char *not_dat
 		/* free memory allocated to the notification list */
 		free_notification_list();
 
+                /* 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);
 
@@ -1385,6 +1388,9 @@ int host_notification(host *hst, int type, char *not_author, char *not_data, int
 		/* free memory allocated to the notification list */
 		free_notification_list();
 
+		/* 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_summary_macros_r(&mac);
 





More information about the icinga-checkins mailing list