From owner-freebsd-current Sun Oct 20 11:53:34 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 5143937B401; Sun, 20 Oct 2002 11:53:33 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id A6F0743E8A; Sun, 20 Oct 2002 11:53:32 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.3/8.12.3) with ESMTP id g9KIrKpk075544; Sun, 20 Oct 2002 12:53:25 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 20 Oct 2002 12:53:08 -0600 (MDT) Message-Id: <20021020.125308.35255652.imp@bsdimp.com> To: jake@locore.ca Cc: ben@stuyts.nl, tlambert2@mindspring.com, current@FreeBSD.ORG, jroberson@chesapeake.net, rwatson@FreeBSD.ORG, jeff@FreeBSD.ORG, alfred@FreeBSD.ORG Subject: Re: [Ugly PATCH] Again: panic kmem_malloc() From: "M. Warner Losh" In-Reply-To: <20021018213608.A60569@locore.ca> References: <3DB07805.AB4BAA15@mindspring.com> <4.3.2.7.2.20021019001010.00b89f28@terminus> <20021018213608.A60569@locore.ca> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message