Lists: | Postg스포츠 토토 |
---|
From: | Jason Tishler <Jason(dot)Tishler(at)dothill(dot)com> |
---|---|
To: | Earnie Boyd <earnie_boyd(at)yahoo(dot)com> |
Cc: | "Dr(dot) Volker Zell" <Dr(dot)Volker(dot)Zell(at)oracle(dot)com>, Cygwin <cygwin(at)sources(dot)redhat(dot)com>, pgsql-ports(at)postgresql(dot)org |
Subject: | Re: Problem Building Cygwin PostgreSQL |
Date: | 2000-09-22 19:50:51 |
Message-ID: | 20000922155051.A2515@DP |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | Postg스포츠 토토 |
Earnie,
On Fri, Sep 22, 2000 at 11:01:25AM -0700, Earnie Boyd wrote:
> Hmm... This appears that it would potentially cause a memory leak. What
> happens if instead of this patch you initialize the pointer to NULL?
I guess that I should have giving more context:
void
usage(void)
{
...
user = getenv("USER");
if (!user)
{
#ifndef WIN32
pw = getpwuid(geteuid());
if (pw)
user = pw->pw_name;
...
#else
user = "?";
#endif
}
...
#if !defined(WIN32) && !defined(__CYGWIN__)
if (pw)
free(pw);
#endif
}
The relevant Cygwin source (i.e., src/winsup/cygwin/passwd.cc) and the
getpwuid() man page (from Solaris):
The functions getpwnam(), getpwuid(), getpwent(), and
fgetpwent() use *static* storage that is re-used in each call,
making these routines unsafe for use in multithreaded appli-
cations.
seemed to indicate that free-ing the return value from getpwuid() was a
bad idea. Can someone confirm or refute this supposition?
Thanks,
Jason
--
Jason Tishler
Director, Software Engineering Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corporation Fax: +1 (732) 264-8798
82 Bethany Road, Suite 7 Email: Jason(dot)Tishler(at)dothill(dot)com
Hazlet, NJ 07730 USA WWW: http://www.dothill.com
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Jason Tishler <Jason(dot)Tishler(at)dothill(dot)com> |
Cc: | Earnie Boyd <earnie_boyd(at)yahoo(dot)com>, "Dr(dot) Volker Zell" <Dr(dot)Volker(dot)Zell(at)oracle(dot)com>, Cygwin <cygwin(at)sources(dot)redhat(dot)com>, pgsql-ports(at)postgresql(dot)org |
Subject: | Re: Re: Problem Building Cygwin PostgreSQL |
Date: | 2000-10-17 03:21:46 |
Message-ID: | 200010170321.XAA03987@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-ports |
Looks like this is fixed in current sources.
> Earnie,
>
> On Fri, Sep 22, 2000 at 11:01:25AM -0700, Earnie Boyd wrote:
> > Hmm... This appears that it would potentially cause a memory leak. What
> > happens if instead of this patch you initialize the pointer to NULL?
>
> I guess that I should have giving more context:
>
> void
> usage(void)
> {
> ...
> user = getenv("USER");
> if (!user)
> {
> #ifndef WIN32
> pw = getpwuid(geteuid());
> if (pw)
> user = pw->pw_name;
> ...
> #else
> user = "?";
> #endif
> }
> ...
> #if !defined(WIN32) && !defined(__CYGWIN__)
> if (pw)
> free(pw);
> #endif
> }
>
> The relevant Cygwin source (i.e., src/winsup/cygwin/passwd.cc) and the
> getpwuid() man page (from Solaris):
>
> The functions getpwnam(), getpwuid(), getpwent(), and
> fgetpwent() use *static* storage that is re-used in each call,
> making these routines unsafe for use in multithreaded appli-
> cations.
>
> seemed to indicate that free-ing the return value from getpwuid() was a
> bad idea. Can someone confirm or refute this supposition?
>
> Thanks,
> Jason
>
> --
> Jason Tishler
> Director, Software Engineering Phone: +1 (732) 264-8770 x235
> Dot Hill Systems Corporation Fax: +1 (732) 264-8798
> 82 Bethany Road, Suite 7 Email: Jason(dot)Tishler(at)dothill(dot)com
> Hazlet, NJ 07730 USA WWW: http://www.dothill.com
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026