pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kurt Mielke <kurt@it-pilots.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6133: -lpq frees unallocated memory on exit
Date: Wed, 27 Jul 2011 20:15:30 GMT
Message-ID: <201107272015.p6RKFUkV094593@wwwmaster.postgresql.org> (raw)


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.



view thread (2+ messages)  latest in thread

Message-ID: <201107272015.p6RKFUkV094593@wwwmaster.postgresql.org>
Permalink:  ../201107272015.p6RKFUkV094593@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201107272015.p6RKFUkV094593@wwwmaster.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: kurt@it-pilots.com
  Subject: Re: BUG #6133: -lpq frees unallocated memory on exit
  In-Reply-To: <201107272015.p6RKFUkV094593@wwwmaster.postgresql.org>
  References: <201107272015.p6RKFUkV094593@wwwmaster.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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