[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: notifications: free raw_command when we don't need it anymore to prevent leaks

git at icinga.org git at icinga.org
Tue Aug 7 19:32:30 CEST 2012


Module: icinga-core
Branch: mfriedrich/core
Commit: 57d2133ec67d795839f1d137d8c792375005afbe
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=57d2133ec67d795839f1d137d8c792375005afbe

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Tue Aug  7 19:26:41 2012 +0200

notifications: free raw_command when we don't need it anymore to prevent leaks

---

 base/notifications.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/base/notifications.c b/base/notifications.c
index 291a214..d1c73fa 100644
--- a/base/notifications.c
+++ b/base/notifications.c
@@ -825,6 +825,7 @@ int notify_contact_of_service(icinga_macros *mac, contact *cntct, service *svc,
 
 		/* process any macros contained in the argument */
 		process_macros_r(mac, raw_command, &processed_command, macro_options);
+		my_free(raw_command);
 		if (processed_command == NULL)
 			continue;
 
@@ -885,7 +886,6 @@ int notify_contact_of_service(icinga_macros *mac, contact *cntct, service *svc,
 
 		/* free memory */
 		my_free(command_name);
-		my_free(raw_command);
 		my_free(processed_command);
 
 		/* get end time */
@@ -1923,6 +1923,7 @@ int notify_contact_of_host(icinga_macros *mac, contact *cntct, host *hst, int ty
 
 		/* process any macros contained in the argument */
 		process_macros_r(mac, raw_command, &processed_command, macro_options);
+		my_free(raw_command);
 		if (processed_command == NULL)
 			continue;
 
@@ -1983,7 +1984,6 @@ int notify_contact_of_host(icinga_macros *mac, contact *cntct, host *hst, int ty
 
 		/* free memory */
 		my_free(command_name);
-		my_free(raw_command);
 		my_free(processed_command);
 
 		/* get end time */





More information about the icinga-checkins mailing list