diff options
author | Michael Meskes <meskes@postgresql.org> | 2006-06-06 11:31:55 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2006-06-06 11:31:55 +0000 |
commit | 0251602fc9b8756419f8941bcc24fb631ba6ba72 (patch) | |
tree | 5e1e3cd31211922503956db1a794e02406ba8288 /src/interfaces/ecpg/ecpglib/data.c | |
parent | ff0ac57db9e4bfd9c51b159563e1bf94522bb35f (diff) | |
download | postgresql-0251602fc9b8756419f8941bcc24fb631ba6ba72.tar.gz postgresql-0251602fc9b8756419f8941bcc24fb631ba6ba72.zip |
Fixed two more memory leaks in ecpglib.
Synced parser.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/data.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/data.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c index d88859b72c2..1f6d26f7eea 100644 --- a/src/interfaces/ecpg/ecpglib/data.c +++ b/src/interfaces/ecpg/ecpglib/data.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.30 2006/01/17 19:49:23 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.31 2006/06/06 11:31:55 meskes Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -462,7 +462,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, nres = PGTYPESnumeric_from_asc(pval, &scan_length); /* did we get an error? */ - if (errno != 0) + if (nres == NULL) { ECPGlog("ECPGget_data line %d: RESULT: %s errno %d\n", lineno, pval ? pval : "", errno); @@ -487,6 +487,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, if (garbage_left(isarray, scan_length, compat)) { + free(nres); ECPGraise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); return (false); } @@ -500,6 +501,8 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, PGTYPESnumeric_copy(nres, (numeric *) (var + offset * act_tuple)); else PGTYPESnumeric_to_decimal(nres, (decimal *) (var + offset * act_tuple)); + + free(nres); break; case ECPGt_interval: @@ -511,7 +514,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ires = PGTYPESinterval_from_asc(pval, &scan_length); /* did we get an error? */ - if (errno != 0) + if (ires == NULL) { if (INFORMIX_MODE(compat)) { @@ -534,6 +537,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, if (garbage_left(isarray, scan_length, compat)) { + free(ires); ECPGraise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); return (false); } @@ -544,6 +548,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, ires = PGTYPESinterval_from_asc("0 seconds", NULL); PGTYPESinterval_copy(ires, (interval *) (var + offset * act_tuple)); + free(ires); break; case ECPGt_date: if (pval) |