From bac9369a06c58d6071888737fd49903b29b36893 Mon Sep 17 00:00:00 2001 From: christos Date: Tue, 12 Mar 2002 00:44:16 +0000 Subject: [PATCH] PR/15877: Ed Ravin: make sure that we cleanup enough of the job structure, in jobfree() so that we don't fail when we use a malloc where free() trashes freed memory. --- bin/sh/jobs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index d8e13e01c197..aa819c42ed24 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -1,4 +1,4 @@ -/* $NetBSD: jobs.c,v 1.40 2001/09/16 16:34:23 wiz Exp $ */ +/* $NetBSD: jobs.c,v 1.41 2002/03/12 00:44:16 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: jobs.c,v 1.40 2001/09/16 16:34:23 wiz Exp $"); +__RCSID("$NetBSD: jobs.c,v 1.41 2002/03/12 00:44:16 christos Exp $"); #endif #endif /* not lint */ @@ -360,8 +360,11 @@ freejob(jp) if (ps->cmd != nullstr) ckfree(ps->cmd); } - if (jp->ps != &jp->ps0) + if (jp->ps != &jp->ps0) { ckfree(jp->ps); + jp->ps = &jp->ps0; + } + jp->nprocs = 0; jp->used = 0; #if JOBS if (curjob == jp - jobtab + 1)