[icinga-checkins] icinga.org: icinga-core/mfriedrich/workers: sehandlers: raw_commandline free asap

git at icinga.org git at icinga.org
Tue Aug 7 20:23:39 CEST 2012


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

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

sehandlers: raw_commandline free asap

---

 base/sehandlers.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/base/sehandlers.c b/base/sehandlers.c
index 0f9b26b..8b52c87 100644
--- a/base/sehandlers.c
+++ b/base/sehandlers.c
@@ -286,6 +286,7 @@ int run_global_service_event_handler(icinga_macros *mac, service *svc) {
 
 	/* process any macros in the raw command line */
 	process_macros_r(mac, raw_command, &processed_command, macro_options);
+	my_free(raw_command);
 	if (processed_command == NULL)
 		return ERROR;
 
@@ -306,7 +307,6 @@ int run_global_service_event_handler(icinga_macros *mac, service *svc) {
 	/* neb module wants to override (or cancel) the event handler - perhaps it will run the eventhandler itself */
 	if (neb_result == NEBERROR_CALLBACKOVERRIDE) {
 		my_free(processed_command);
-		my_free(raw_command);
 		my_free(raw_logentry);
 		my_free(processed_logentry);
 		return OK;
@@ -333,7 +333,6 @@ int run_global_service_event_handler(icinga_macros *mac, service *svc) {
 
 	/* free memory */
 	my_free(command_output);
-	my_free(raw_command);
 	my_free(processed_command);
 	my_free(raw_logentry);
 	my_free(processed_logentry);
@@ -386,6 +385,7 @@ int run_service_event_handler(icinga_macros *mac, service *svc) {
 
 	/* process any macros in the raw command line */
 	process_macros_r(mac, raw_command, &processed_command, macro_options);
+	my_free(raw_command);
 	if (processed_command == NULL)
 		return ERROR;
 
@@ -406,7 +406,6 @@ int run_service_event_handler(icinga_macros *mac, service *svc) {
 	/* neb module wants to override (or cancel) the event handler - perhaps it will run the eventhandler itself */
 	if (neb_result == NEBERROR_CALLBACKOVERRIDE) {
 		my_free(processed_command);
-		my_free(raw_command);
 		my_free(raw_logentry);
 		my_free(processed_logentry);
 		return OK;
@@ -433,7 +432,6 @@ int run_service_event_handler(icinga_macros *mac, service *svc) {
 
 	/* free memory */
 	my_free(command_output);
-	my_free(raw_command);
 	my_free(processed_command);
 	my_free(raw_logentry);
 	my_free(processed_logentry);
@@ -531,6 +529,7 @@ int run_global_host_event_handler(icinga_macros *mac, host *hst) {
 
 	/* process any macros in the raw command line */
 	process_macros_r(mac, raw_command, &processed_command, macro_options);
+	my_free(raw_command);
 	if (processed_command == NULL)
 		return ERROR;
 
@@ -551,7 +550,6 @@ int run_global_host_event_handler(icinga_macros *mac, host *hst) {
 	/* neb module wants to override (or cancel) the event handler - perhaps it will run the eventhandler itself */
 	if (neb_result == NEBERROR_CALLBACKOVERRIDE) {
 		my_free(processed_command);
-		my_free(raw_command);
 		my_free(raw_logentry);
 		my_free(processed_logentry);
 		return OK;
@@ -578,7 +576,6 @@ int run_global_host_event_handler(icinga_macros *mac, host *hst) {
 
 	/* free memory */
 	my_free(command_output);
-	my_free(raw_command);
 	my_free(processed_command);
 	my_free(raw_logentry);
 	my_free(processed_logentry);
@@ -630,6 +627,7 @@ int run_host_event_handler(icinga_macros *mac, host *hst) {
 
 	/* process any macros in the raw command line */
 	process_macros_r(mac, raw_command, &processed_command, macro_options);
+	my_free(raw_command);
 	if (processed_command == NULL)
 		return ERROR;
 
@@ -650,7 +648,6 @@ int run_host_event_handler(icinga_macros *mac, host *hst) {
 	/* neb module wants to override (or cancel) the event handler - perhaps it will run the eventhandler itself */
 	if (neb_result == NEBERROR_CALLBACKOVERRIDE) {
 		my_free(processed_command);
-		my_free(raw_command);
 		my_free(raw_logentry);
 		my_free(processed_logentry);
 		return OK;
@@ -676,7 +673,6 @@ int run_host_event_handler(icinga_macros *mac, host *hst) {
 
 	/* free memory */
 	my_free(command_output);
-	my_free(raw_command);
 	my_free(processed_command);
 	my_free(raw_logentry);
 	my_free(processed_logentry);





More information about the icinga-checkins mailing list