Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] scripts/common.c minor memory leak

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] scripts/common.c minor memory leak
Date: 2006-10-03 21:46:56
Message-ID: 200610032146.k93LkuA17441@momjian.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Andrew Dunstan wrote:
> Martijn van Oosterhout wrote:
> > Just a minor thing. In yesno_prompt(), the value is resp is allocated
> > memory that is never freed.
> >
> > File: src/bin/scripts/common.c
> > Line: 218
> >
> > Not terribly important though, it's not used in critical utilities, but
> > it's used often.
> >
> > Found by coverity.
> >   
> 
> It is surely not the only memory leak.  We know there are some and in 
> most cases (like this) they aren't worth the trouble to clean up. If it 
> were used in psql or the backend I'd be worried, but it isn't, so I'm not.

I have applied the attached patch to fix this.  One reason I think it is
good to fix this is because it illustrates poor use of simple_prompt(),
that might be copied by others.

-- 
  Bruce Momjian   bruce(at)momjian(dot)us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Attachment: /bjm/diff
Description: text/x-diff (1.5 KB)

In response to

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2006-10-03 21:48:36
Subject: Re: workaround for buggy strtod is not necessary
Previous:From: Zdenek KotalaDate: 2006-10-03 21:37:33
Subject: workaround for buggy strtod is not necessary

pgsql-patches by date

Next:From: Bruce MomjianDate: 2006-10-03 22:12:17
Subject: Re: pgevent fixes
Previous:From: Andrew DunstanDate: 2006-10-03 21:27:31
Subject: Re: scripts/common.c minor memory leak

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group