Re: [PATCHES] Re: [HACKERS] Everything leaks; How it mm suppose to work?
Vadim B. Mikheev <vadim@sable.krasnoyarsk.su>
From: "Vadim B. Mikheev" <vadim@sable.krasnoyarsk.su>
To: Bruce Momjian <maillist@candle.pha.pa.us>
Cc: Darren King <darrenk@insightdist.com>, hackers@postgreSQL.org
Date: 1998-04-05T13:54:57Z
Lists: pgsql-hackers
Bruce Momjian wrote:
>
> > I seem to recall a discussion a long time ago about using strdup and how
> > it would leak when using the postgres memory contexts, and that the pstrdup
> > code was created to be used instead of strdup to "fix" this.
> >
>
> OK, here is a patch to fix the memory leak problem. Not sure when this
> was introduced, but who cares. Probably not Vadim, as I first thought.
(Sure - not me :). Congratulations with finding this!
storage/buffer/bufmgr.c:BufferAlloc():
strcpy(buf->sb_dbname, GetDatabaseName());
and so we had leak for _every_ new buffer allocation!
But why strdup() was added there? (Hope that nothing is broken now).
Vadim