[icinga-checkins] icinga.org: icinga-core/mfriedrich/workers: 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 20:23:39 CEST 2012


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

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 49e8c33..a107422 100644
--- a/base/notifications.c
+++ b/base/notifications.c
@@ -826,6 +826,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;
 
@@ -881,7 +882,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 */
@@ -1918,6 +1918,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;
 
@@ -1974,7 +1975,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