[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: memory leak & patch
From: |
Kenneth Lorber |
Subject: |
Re: memory leak & patch |
Date: |
Wed, 11 Jun 2003 12:53:00 -0400 (EDT) |
From scjones@thor.sdrc.com Wed Jun 11 12:42:56 2003
Subject: Re: memory leak & patch
To: keni@his.com (Kenneth Lorber)
Date: Wed, 11 Jun 2003 12:41:21 -0400 (EDT)
Cc: bug-cvs@gnu.org
In-Reply-To: <200306111622.h5BGMHp01504@nethack.home> from "Kenneth
Lorber" at Jun 11, 2003 12:22:17 PM
From: lawrence.jones@eds.com (Larry Jones)
X-Mailer: ELM [version 2.5 PL3]
Kenneth Lorber writes:
>
> This fixes a leak in xresolvepath.
No it doesn't. Calling error() with an initial argument of 1 makes it
call exit(), which terminates the process and frees *all* the memory, so
there's no leak.
I almost put a note about that in the email, but I decided not to - my
mistake.
I think the addition of the final free() fixes a real leak. (owd comes from
xgetwd(), and xgetwd()'s return value needs to be free()'d.)
The free()'s before the calls to error() bring up a style issue. If I'm
debugging a program, I want it to release all memory before it exit()'s so
I can see what's leaked, even if I'm exiting on an error. If cvs
doesn't get coded that way, my apologies for not noticing and cleaning up
too much :-)
keni