I am having trouble with PQclear causing a segmentation fault, and I don't
really know where to look. I have 3 identical tables (only 2 come into play)
all of the form
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| leaf1 | int4 not null | 4 |
| leaf2 | int4 not null | 4 |
+----------------------------------+----------------------------------+-------+
and the last thing that happens before trouble is:
SELECT leaf2 FROM pers_room WHERE leaf1=1
SELECT leaf1 FROM pers_room WHERE leaf2=1
SELECT leaf2 FROM pers_comp WHERE leaf1=1
Segmentation fault (core dumped)
#0 0x40112370 in free ()
#1 0x400b5060 in _GLOBAL_OFFSET_TABLE_ () at pqsignal.c:42
#2 0x400ad3be in PQclear (res=0x76280) at fe-exec.c:325
#3 0x400a6181 in PgConnection::Exec (this=0xefbfd44c, query=0x76280 "SELECT leaf2 FROM pers_comp WHERE leaf1=1")
atpgconnection.cc:98
323 /* Free the top-level tuple pointer array */
324 if (res->tuples)
325 free(res->tuples);
and I suspect from the manpage:
Otherwise, if the argument does not match a pointer earlier returned by the calloc() malloc() or realloc()
function,or if the space has been deallocated by a call to free() or realloc(), general havoc may occur.
As you see from the backtrace, I am using libpq++. Anyone have a suggestion
where to look?
Cheers,
Patrick