Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Jul 2001 07:37:37 -0700
From:      Mark Peek <mark@whistle.com>
To:        freebsd-questions@FreeBSD.ORG, stable@FreeBSD.ORG
Subject:   Re: cron exited on signal 11
Message-ID:  <p05100300b773635956ee@[207.76.207.129]>
In-Reply-To: <200107120602.f6C628T41618@earth.backplane.com>
References:  <1399129667.20010709164730@mail.ru>            <006e01c10927$c3151d80$6d36120a@comsys.ntukpi.kiev.ua>            <18810557330.20010711121320@mail.ru>            <86itgz4eyf.fsf@hades.hell.gr> <20010711224709.11607.qmail@panda.freebsdsystems.com> <p0510032cb772c6d1161d@[207.76.207.129]> <200107120602.f6C628T41618@earth.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At 11:02 PM -0700 7/11/01, Matt Dillon wrote:
>     Well this certainly opens up a can of worms!  Not your patch, but what
>     it implies.  For example, env_set() assumes envp is not NULL as well.
>     In fact, most of the code assumes envp is not NULL, and 99% of the time
>     that is true due to the env_init() calls.
>
>     I found at least one case in the code where free_entry() is called with
>     e->envp == NULL.  Perhaps a more correct fix would simply be to have
>     free_entry() check for e->envp != NULL before calling env_free() rather
>     then having env_free() check for NULL.
>
>     It would be great if the original poster could try this patch rather
>     then the above patch to see if it also fixes the problem.
>
>						-Matt
>
>Index: lib/entry.c
>===================================================================
>RCS file: /home/ncvs/src/usr.sbin/cron/lib/entry.c,v
>retrieving revision 1.12
>diff -u -r1.12 entry.c
>--- lib/entry.c	2001/06/13 05:49:37	1.12
>+++ lib/entry.c	2001/07/12 05:59:54
>@@ -74,7 +74,8 @@
>  		free(e->class);
>  #endif
>  	free(e->cmd);
>-	env_free(e->envp);
>+	if (e->envp != NULL)
>+		env_free(e->envp);
>  	free(e);
>  }


Matt,
I see your point about env_set() and env_free() being orthogonal wrt 
envp != NULL. I also contemplated making the same change you made 
above. However, I thought it was better to have free() style 
semantics and allow env_free() to properly handle a NULL pointer. 
("Be liberal in what you accept...")

Mark

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05100300b773635956ee>