Re: segfault which isn't supposed to happen (including example code)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: eric <plukje(at)gmx(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: segfault which isn't supposed to happen (including example code)
Date: 2002-07-09 15:36:29
Message-ID: 4725.1026228989@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

eric <plukje(at)gmx(dot)net> writes:
> this segfault is all about PQclear();

If you pass an uninitialized pointer to a library routine, it's likely
to segfault. This is *your* bug, not the library's, because the library
routine has no way to know that you gave it a random pointer value
instead of something that actually points to valid data.

You might want to adjust your compiler switches so that the compiler
warns about uses of uninitialized variables. In gcc, "-O -Wall" is
a pretty good combination.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2002-07-09 15:40:49 Re: Insert aborted, but Sequence increased
Previous Message Stephan Szabo 2002-07-09 15:24:45 Re: Insert aborted, but Sequence increased