BUG #6133: -lpq frees unallocated memory on exit

Поиск
Список
Период
Сортировка
От Kurt Mielke
Тема BUG #6133: -lpq frees unallocated memory on exit
Дата
Msg-id 201107272015.p6RKFUkV094593@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #6133: -lpq frees unallocated memory on exit  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: BUG #5953: pgadmin sql-query text pad doesn't work
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #6133: -lpq frees unallocated memory on exit