1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-25 20:23:07 +03:00

Check for out of memory when allocating sqlca.

Patch by Michael Paquier
This commit is contained in:
Michael Meskes
2015-06-15 14:21:03 +02:00
parent af0b49fc98
commit 94a484222c
7 changed files with 104 additions and 1 deletions

View File

@@ -132,6 +132,13 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
int value_for_indicator = 0;
long log_offset;
if (sqlca == NULL)
{
ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
return (false);
}
/*
* If we are running in a regression test, do not log the offset variable,
* it depends on the machine's alignment.