pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6133: -lpq frees unallocated memory on exit
2+ messages / 2 participants
[nested] [flat]

* BUG #6133: -lpq frees unallocated memory on exit
@ 2011-07-27 20:15  Kurt Mielke <kurt@it-pilots.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kurt Mielke @ 2011-07-27 20:15 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      6133
Logged by:          Kurt Mielke
Email address:      kurt@it-pilots.com
PostgreSQL version: 8.4.8 + 9.0.4
Operating system:   Centos X86_64 5.5 & 6.0
Description:        -lpq frees unallocated memory on exit
Details: 

x.c: is a very simple c-program:

main() { }

When compiled with

gcc -o x -lpq x.c

valgrind ./x

says "invalid free ... Address 0x4029508 is not stack'd, malloc'd or
(recently) free'd"

gcc -o x x.c

does not have this problem

I have tried linking with centos distribution developer versions and tried
making it from 8.4.2 8.4.8 9.0.4 tar balls, using configure with no options
The problem is the same - I found a posting from 2002 which I think is the
same problem, but I found no follow-ups.

I looked at make output to identify other libraries, which might be
responsible - but:

gcc -o x -lcrypt -ldl -lm -lpgport -lpgtypes -lpthread -lreadline -lz x.c

is OK, while linking with either -lpq or -lecpg will give you the valgrind
error.

On the two machines I tried it on I have:
gcc.x86_64 4.4.4-13.el6 / glibc.i686 2.12-1.7.el6_0.5
gcc.x86_64 4.1.2-50.el5 / glibc.i686 2.5-58.el5_6.4

And "Yes!" - the problem is also present if I do some real pg-lib, like
running testlibpq3.c - again there is one free too many.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #6133: -lpq frees unallocated memory on exit
@ 2011-07-27 23:50  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Kurt Mielke <kurt@it-pilots.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2011-07-27 23:50 UTC (permalink / raw)
  To: Kurt Mielke <kurt@it-pilots.com>; +Cc: pgsql-bugs

"Kurt Mielke" <kurt@it-pilots.com> writes:
> PostgreSQL version: 8.4.8 + 9.0.4
> Operating system:   Centos X86_64 5.5 & 6.0

> x.c: is a very simple c-program:

> main() { }

> When compiled with

> gcc -o x -lpq x.c

> valgrind ./x

> says "invalid free ... Address 0x4029508 is not stack'd, malloc'd or
> (recently) free'd"

Can't reproduce this on my own Red Hat machines ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-07-27 23:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-07-27 20:15 BUG #6133: -lpq frees unallocated memory on exit Kurt Mielke <kurt@it-pilots.com>
2011-07-27 23:50 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox