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:24 +0200
commit2a781b5bb260209be0d856c6a43d15194d6848e0 (patch)
tree197d2ad390dbeeaeaf5440b2a1750f7a700943e7 /src/interfaces/ecpg/ecpglib/data.c
parent853222ce0012d56f26138709eecc7939f04a996d (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 2d0c1180a3c..1e626768e06 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.