Improve handling of out-of-memory in libpq.

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: 6d88c1fc5f2eba341186e13dc9ab4a0ca8eeeeba
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2015-07-07T15:45:24Z
Releases: 9.2.14
Improve handling of out-of-memory in libpq.

If an allocation fails in the main message handling loop, pqParseInput3
or pqParseInput2, it should not be treated as "not enough data available
yet". Otherwise libpq will wait indefinitely for more data to arrive from
the server, and gets stuck forever.

This isn't a complete fix - getParamDescriptions and getCopyStart still
have the same issue, but it's a step in the right direction.

Michael Paquier and me. Backpatch to all supported versions.

Files

PathChange+/−
src/interfaces/libpq/fe-protocol2.c modified +38 −13
src/interfaces/libpq/fe-protocol3.c modified +45 −18