summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 8e165d97ac7..a90fb41483d 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -855,14 +855,22 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
for (element = 0; element < var->arrsize; element++)
{
+ int result;
+
nval = PGTYPESnumeric_new();
if (!nval)
return false;
if (var->type == ECPGt_numeric)
- PGTYPESnumeric_copy((numeric *) ((var + var->offset * element)->value), nval);
+ result = PGTYPESnumeric_copy((numeric *) ((var + var->offset * element)->value), nval);
else
- PGTYPESnumeric_from_decimal((decimal *) ((var + var->offset * element)->value), nval);
+ result = PGTYPESnumeric_from_decimal((decimal *) ((var + var->offset * element)->value), nval);
+
+ if (result != 0)
+ {
+ PGTYPESnumeric_free(nval);
+ return false;
+ }
str = PGTYPESnumeric_to_asc(nval, nval->dscale);
slen = strlen(str);
@@ -882,14 +890,22 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
}
else
{
+ int result;
+
nval = PGTYPESnumeric_new();
if (!nval)
return false;
if (var->type == ECPGt_numeric)
- PGTYPESnumeric_copy((numeric *) (var->value), nval);
+ result = PGTYPESnumeric_copy((numeric *) (var->value), nval);
else
- PGTYPESnumeric_from_decimal((decimal *) (var->value), nval);
+ result = PGTYPESnumeric_from_decimal((decimal *) (var->value), nval);
+
+ if (result != 0)
+ {
+ PGTYPESnumeric_free(nval);
+ return false;
+ }
str = PGTYPESnumeric_to_asc(nval, nval->dscale);
slen = strlen(str);
@@ -1026,7 +1042,10 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
{
str = quote_postgres(PGTYPEStimestamp_to_asc(*(timestamp *) ((var + var->offset * element)->value)), quote, lineno);
if (!str)
+ {
+ ecpg_free(mallocedval);
return false;
+ }
slen = strlen(str);