[icinga-checkins] icinga.org: icinga-core/dev/ido: core: fix memory leak in xodtemplate.c ( thx Dorian Guillois)

git at icinga.org git at icinga.org
Tue Nov 15 10:06:45 CET 2011


Module: icinga-core
Branch: dev/ido
Commit: 7ae6a89e7860f619dc1282ca6e2fef6a136bef74
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=7ae6a89e7860f619dc1282ca6e2fef6a136bef74

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Thu Nov 10 15:17:43 2011 +0100

core: fix memory leak in xodtemplate.c (thx Dorian Guillois)

---

 Changelog           |    1 +
 xdata/xodtemplate.c |    8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index ab5c1ff..9b9c831 100644
--- a/Changelog
+++ b/Changelog
@@ -39,6 +39,7 @@ FIXES
 * core: fix $NOTIFICATIONRECIPIENTS$ macro contains all contacts assigned to host|service, not only notified contacts #2023
 * core: plug memory leak in downtimes comment add (Dorian Guillois) #1979
 * core: make first_notification_delay depend on the first !OK hard state change and don't reset timer for new hard states which would replace it (Rogerio F Cunha) #1918
+* core: fix memory leak in xodtemplate.c (thx Dorian Guillois)
 
 * classic ui: fix for Classic-UI displays bad timeperiods #1989
 
diff --git a/xdata/xodtemplate.c b/xdata/xodtemplate.c
index b6ee302..e6772fe 100644
--- a/xdata/xodtemplate.c
+++ b/xdata/xodtemplate.c
@@ -282,8 +282,10 @@ int xodtemplate_read_config_data(char *main_config_file, int options, int cache,
 			if (!strcmp(var, "xodtemplate_config_file") || !strcmp(var, "cfg_file")) {
 
 				temp_buffer = (char *)strdup(val);
-				if (config_base_dir != NULL && val[0] != '/')
+				if (config_base_dir != NULL && val[0] != '/') {
 					dummy = asprintf(&config_file, "%s/%s", config_base_dir, temp_buffer);
+					my_free(temp_buffer);
+				}
 				else
 					config_file = temp_buffer;
 
@@ -301,8 +303,10 @@ int xodtemplate_read_config_data(char *main_config_file, int options, int cache,
 			else if (!strcmp(var, "xodtemplate_config_dir") || !strcmp(var, "cfg_dir")) {
 
 				temp_buffer = (char *)strdup(val);
-				if (config_base_dir != NULL && val[0] != '/')
+				if (config_base_dir != NULL && val[0] != '/') {
 					dummy = asprintf(&config_file, "%s/%s", config_base_dir, temp_buffer);
+					my_free(temp_buffer);
+				}
 				else
 					config_file = temp_buffer;
 





More information about the icinga-checkins mailing list