[PATCH 3/4] base/nerd: Fix crash during shutdown after using opathchecks
Andreas Ericsson
ae at op5.se
Wed Nov 28 12:58:08 CET 2012
On 11/27/2012 05:41 PM, robin.sonefors at op5.com wrote:
> 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;
This is unnecessary, as the .bss segment is implicitly zero'd out at
program loadtime.
> 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);
> }
>
This is a good catch though. Applied (with mentioned modifications).
Thanks.
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net
More information about the Developers
mailing list