[PATCH 3/4] base/nerd: Fix crash during shutdown after using opathchecks

robin.sonefors at op5.com robin.sonefors at op5.com
Tue Nov 27 17:41:51 CET 2012


From: Robin Sonefors <robin.sonefors at op5.com>

If opathchecks had been used, the cleanup code didn't properly zero the
host_parent_path_cache pointer, meaning it would dangle and cause
crashes the next time it was used.

Signed-off-by: Robin Sonefors <robin.sonefors at op5.com>
---
 base/nerd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/base/nerd.c b/base/nerd.c
index 05a0953..e0cf6a5 100644
--- a/base/nerd.c
+++ b/base/nerd.c
@@ -254,7 +254,7 @@ static int chan_service_checks(int cb, void *data)
 	return 0;
 }
 
-static char **host_parent_path_cache;
+static char **host_parent_path_cache = NULL;
 static const char *host_parent_path(host *leaf, char sep)
 {
 	char *ret;
@@ -341,7 +341,7 @@ static int nerd_deinit(void)
 		for(i = 0; i < num_objects.hosts; i++) {
 			my_free(host_parent_path_cache[i]);
 		}
-		free(host_parent_path_cache);
+		my_free(host_parent_path_cache);
 	}
 
 	for(i = 0; i < num_channels; i++) {
-- 
1.7.11.7


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov




More information about the Developers mailing list