Attached is a patch (against 7.3.4) to check the return values of somecalls (malloc, realloc, etc.) for failed memory allocations in libpq.
-- Dave Allendaveallen(at)acm(dot)org