Joe La Frite <joelafrite84@gmail.com> writes:
> Tough after some testing, I'm fairly sure the problem isn't caused by
> libpq at all. I think the heap gets corrupted at some point before the
> call to PQconnectdb is made, as replacing the call by a simple void*
> test = malloc(10) causes it to crash as well.
Yeah, a crash inside malloc almost certainly means that you've stomped
on some of malloc's internal data structures, probably by overrunning
the allocated size of some malloc'd data chunk. I'd suggest valgrind,
ElectricFence, or similar for locating the offending code.
regards, tom lane