Skip site navigation (1) Skip section navigation (2)

Re: SIGSEGV in PQreset(..)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: az(at)rpiva(dot)lv
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: SIGSEGV in PQreset(..)
Date: 2006-02-13 22:09:03
Message-ID: 5379.1139868543@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Arturs Zoldners <az(at)rpiva(dot)lv> writes:
> The following code raises SIGSEGV:

>         PGconn* conn = PQconnectdb("x");
>         ConnStatusType status = PQstatus(conn);
> 	//status == CONNECTION_BAD
>         PQreset(conn);

PQreset assumes it's been passed a reasonably valid PGconn, which is not
the case if conninfo_parse couldn't make any sense of the connect
options string.  We probably ought to add a state flag to indicate
whether the options have been set up successfully, and cause PQreset to
fail if not.  (The alternative seems to be for PQreset to refuse to do
anything if the connection state is CONNECTION_BAD, but that looks like
it would destroy most of the usefulness of PQreset ...)

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Stephen FrostDate: 2006-02-14 02:02:59
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Previous:From: Tom LaneDate: 2006-02-13 21:45:08
Subject: Re: BUG #2246: Bad malloc interactions: ecpg, openssl

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group