Re: [PATCHES] Re: [HACKERS] Everything leaks; How it mm suppose to work?

From: "Vadim B(dot) Mikheev" <vadim(at)sable(dot)krasnoyarsk(dot)su>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Darren King <darrenk(at)insightdist(dot)com>, hackers(at)postgreSQL(dot)org
Subject: Re: [PATCHES] Re: [HACKERS] Everything leaks; How it mm suppose to work?
Date: 1998-04-05 13:54:57
Message-ID: 35278D31.5115AC54@sable.krasnoyarsk.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-04-05 14:28:25 Re: [PATCHES] Re: [HACKERS] Everything leaks; How it mm suppose to work?
Previous Message Thomas G. Lockhart 1998-04-05 13:54:47 Automatic type conversion