From owner-freebsd-current Sun Oct 20 13:32:48 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3E8A837B401; Sun, 20 Oct 2002 13:32:47 -0700 (PDT) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD31C43E77; Sun, 20 Oct 2002 13:32:46 -0700 (PDT) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id A1689AE165; Sun, 20 Oct 2002 13:32:46 -0700 (PDT) Date: Sun, 20 Oct 2002 13:32:46 -0700 From: Alfred Perlstein To: "M. Warner Losh" 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> References: <3DB07805.AB4BAA15@mindspring.com> <4.3.2.7.2.20021019001010.00b89f28@terminus> <20021018213608.A60569@locore.ca> <20021020.125308.35255652.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021020.125308.35255652.imp@bsdimp.com> User-Agent: Mutt/1.4i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * M. Warner Losh [021020 11:53] wrote: > In message: <20021018213608.A60569@locore.ca> > Jake Burkholder 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