From owner-freebsd-current Mon Apr 7 16:18:40 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id QAA22423 for current-outgoing; Mon, 7 Apr 1997 16:18:40 -0700 (PDT) Received: from root.com (implode.root.com [198.145.90.17]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id QAA22417 for ; Mon, 7 Apr 1997 16:18:35 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by root.com (8.8.5/8.6.5) with SMTP id QAA05811; Mon, 7 Apr 1997 16:18:14 -0700 (PDT) Message-Id: <199704072318.QAA05811@root.com> X-Authentication-Warning: implode.root.com: localhost [127.0.0.1] didn't use HELO protocol To: Terry Lambert cc: current@freebsd.org Subject: Re: Humorous memory leak In-reply-to: Your message of "Mon, 07 Apr 1997 14:09:47 PDT." <199704072109.OAA02169@phaeton.artisoft.com> From: David Greenman Reply-To: dg@root.com Date: Mon, 07 Apr 1997 16:18:14 -0700 Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >There is a humorous memory leak in kern/kern_exec.c in execve(). > >The path name buffer in the "exec_fail_dealloc:" case should be >unconditionally freed, not conditionally freed based on a valid >ndp->ni_vp. > >The reason is that if the namei() succeeded with the "SAVENAME" flag >set, then a path buffer is allocated independently of whether the >ndp->ni_vp value is valid. > >Actually, I can't see why the test is really necessary at all; the >fail-through should be to "exec_fail:" in any case that could result >in a NULL ndp->ni_vp, right? It's completely harmless. It was added while trying to fix some other problems, but after looking more carefully at the what the logic had mutated into, it wasn't strictly necessary. It does not, however, result in a memory leak; ni_vp will always be valid at that point (else the machine would have already paniced by derefencing a bad pointer). >Anyway, it's funny. You have a strange sense of humor. -DG David Greenman Core-team/Principal Architect, The FreeBSD Project