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