Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Oct 2002 13:32:46 -0700
From:      Alfred Perlstein <alfred@FreeBSD.ORG>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        jake@locore.ca, ben@stuyts.nl, tlambert2@mindspring.com, current@FreeBSD.ORG, jroberson@chesapeake.net, rwatson@FreeBSD.ORG, jeff@FreeBSD.ORG
Subject:   Re: [Ugly PATCH] Again: panic kmem_malloc()
Message-ID:  <20021020203246.GI91539@elvis.mu.org>
In-Reply-To: <20021020.125308.35255652.imp@bsdimp.com>
References:  <3DB07805.AB4BAA15@mindspring.com> <4.3.2.7.2.20021019001010.00b89f28@terminus> <20021018213608.A60569@locore.ca> <20021020.125308.35255652.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* M. Warner Losh <imp@bsdimp.com> [021020 11:53] wrote:
> In message: <20021018213608.A60569@locore.ca>
>             Jake Burkholder <jake@locore.ca> writes:
> : semop() leaks memory.  An important free() was removed by alfred in
> : rev 1.55.  Try this.
> : 
> : Jake
> : 
> : Index: sysv_sem.c
> : ===================================================================
> : RCS file: /home/ncvs/src/sys/kern/sysv_sem.c,v
> : retrieving revision 1.55
> : diff -u -r1.55 sysv_sem.c
> : --- sysv_sem.c	13 Aug 2002 08:47:17 -0000	1.55
> : +++ sysv_sem.c	19 Oct 2002 01:20:35 -0000
> : @@ -1128,6 +1128,8 @@
> :  	td->td_retval[0] = 0;
> :  done2:
> :  	mtx_unlock(sema_mtxp);
> : +	if (sops)
> : +		free(sops, M_SEM);
> :  	return (error);
> :  }
> 
> The kernel free() groks free(NULL, M_FOO), so the if isn't needed.

True, but at that point sops is never NULL.

-- 
-Alfred Perlstein [alfred@freebsd.org]
'Instead of asking why a piece of software is using "1970s technology,"
 start asking why software is ignoring 30 years of accumulated wisdom.'

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




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