summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/prepare.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/prepare.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/prepare.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c
index 06f0135813b..4b1ae839506 100644
--- a/src/interfaces/ecpg/ecpglib/prepare.c
+++ b/src/interfaces/ecpg/ecpglib/prepare.c
@@ -200,7 +200,13 @@ prepare_common(int lineno, struct connection *con, const char *name, const char
stmt->inlist = stmt->outlist = NULL;
/* if we have C variables in our statement replace them with '?' */
- replace_variables(&(stmt->command), lineno);
+ if (!replace_variables(&(stmt->command), lineno))
+ {
+ ecpg_free(stmt->command);
+ ecpg_free(stmt);
+ ecpg_free(this);
+ return false;
+ }
/* add prepared statement to our list */
this->name = ecpg_strdup(name, lineno, NULL);