Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jul 2001 23:02:08 -0700 (PDT)
From:      Matt Dillon <dillon@earth.backplane.com>
To:        Mark Peek <mark@whistle.com>
Cc:        "Lanny Baron" <lnb@FreeBSDsystems.COM>, Giorgos Keramidas <keramida@ceid.upatras.gr>, Igor Kulemzin <kulemzinn@mail.ru>, "Andrey Simonenko" <simon@comsys.ntu-kpi.kiev.ua>, freebsd-questions@FreeBSD.ORG, stable@FreeBSD.ORG
Subject:   Re: cron exited on signal 11
Message-ID:  <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]>

next in thread | previous in thread | raw e-mail | index | archive | help

:Try this patch...
:
:Index: usr.sbin/cron/lib/env.c
:===================================================================
:RCS file: /cvs/freebsd/src/usr.sbin/cron/lib/env.c,v
:retrieving revision 1.9
:diff -u -r1.9 env.c
:--- usr.sbin/cron/lib/env.c	2000/04/30 15:57:00	1.9
:+++ usr.sbin/cron/lib/env.c	2001/07/12 03:12:29
:@@ -41,6 +41,8 @@
:  {
:  	char	**p;
:
:+	if (envp == NULL)
:+		return;
:  	for (p = envp;  *p;  p++)
:  		free(*p);
:  	free(envp);
:
:
:Mark

    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);
 }
 

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?200107120602.f6C628T41618>