libpd - PQfinish() - crashes client application in some cases

From: "Jean-Michel(dot)chabanne" <jeanmichel(dot)chabanne(at)free(dot)fr>
To: pgsql-bugs(at)postgresql(dot)org
Subject: libpd - PQfinish() - crashes client application in some cases
Date: 2001-09-10 20:41:28
Message-ID: 3B9D2578.BC77E980@free.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

I shall try to write english well enough :)

I'm writing a GUI client to access my PostrgeSQL DB, with FLTK
libraries. Sometimes, the client crashes.

I have written un source code, as little as possible, without FLTK
libraries, to test the behavior of PQfinish(), and I noticed :

If no connexion has ever been made, [ PQstatus() retuns 'CONNECTION_BAD'
] , a call to PQfinish(...) does not do something wrong.
But il I connect with PQsetdblogin(..), [ PQstatus returns
'CONNECTION_OK ], a first call to PQfinish(...) disconnects the client,
[ PQstatus returns 'CONNECTION_BAD' ], and A SECOND call to PQfinish(..)
make the client to crash with a system message 'segmentation fault'.

The source code I made to test interactively connections, disconnections
and status is attached to this mail.

I could be told that one does not call PQfinish() when PQstatus is
'CONNECTION_BAD, but it is done in the PostgreSQL documentation example
(Programmer's guide, chapter 1.11)

I hope this will be useful for you.

Here is my computer configuration :
CPU : Pentium II 350 MHz
OS : Linux SuSE 7.2 upgraded with kernel 2.4.8
Compiler : GNU gcc version2.95.3
Linker : GNU ld version 2.10.91 (with BFD 2.10.91.0.4)
PostgreSQL : Version 7.1.3 (downloaded on ftp.fr.postgresql.org )

--
Jean-Michel Chabanne
77450 MONTRY (FRANCE)
48" 54' N - 2" 49' E
Powered by Linux

Attachment Content-Type Size
tstPQ.c text/plain 1.4 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2001-09-11 00:25:06 Re: [BUGS] Build problem with CVS version
Previous Message Szima Gabor 2001-09-10 17:55:58 plpgsql & temp table -bug