summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/data.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2015-06-15 14:21:03 +0200
committerMichael Meskes <meskes@postgresql.org>2015-06-15 14:22:54 +0200
commit4130b2c1fdbe71838baba00312b8ca599b62f98d (patch)
tree9117ddddc3159d612507335a340d2ffdb8e2eab1 /src/interfaces/ecpg/ecpglib/data.c
parent3e2a17eecc4ceb76ac40978a15b26e120dbd52a6 (diff)
Check for out of memory when allocating sqlca.
Patch by Michael Paquier
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/data.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/data.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index f2dbf6687a7..bee7a8dd03c 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -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.