Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 07 Apr 1997 16:18:14 -0700
From:      David Greenman <dg@root.com>
To:        Terry Lambert <terry@lambert.org>
Cc:        current@freebsd.org
Subject:   Re: Humorous memory leak 
Message-ID:  <199704072318.QAA05811@root.com>
In-Reply-To: Your message of "Mon, 07 Apr 1997 14:09:47 PDT." <199704072109.OAA02169@phaeton.artisoft.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
>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



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