diff options
author | Michael Meskes <meskes@postgresql.org> | 2019-01-30 13:58:25 +0100 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2019-01-30 14:35:52 +0100 |
commit | 7ea38f045dad6bbb7fbe807f2486df7370bc0b0f (patch) | |
tree | 4245ff47ee0353ac7cdaddeaae171e1af79c1565 /src/interfaces/ecpg/ecpglib/misc.c | |
parent | e2f731cdba9b7a79cddc64325990a8f51818877b (diff) | |
download | postgresql-7ea38f045dad6bbb7fbe807f2486df7370bc0b0f.tar.gz postgresql-7ea38f045dad6bbb7fbe807f2486df7370bc0b0f.zip |
Change error handling of out of scope variables in ecpg.
The function called can result in an out of memory error that subsequently was
disregarded. Instead it should set the appropriate SQL error variables and be
checked by whatever whenever statement is defined.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/misc.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/misc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c index a26dfdb361f..ee0d3e98fb9 100644 --- a/src/interfaces/ecpg/ecpglib/misc.c +++ b/src/interfaces/ecpg/ecpglib/misc.c @@ -525,6 +525,17 @@ ECPGset_var(int number, void *pointer, int lineno) { struct var_list *ptr; + struct sqlca_t *sqlca = ECPGget_sqlca(); + + if (sqlca == NULL) + { + ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, + ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); + return; + } + + ecpg_init_sqlca(sqlca); + for (ptr = ivlist; ptr != NULL; ptr = ptr->next) { if (ptr->number == number) |