From: Michael Meskes Date: Tue, 6 Jun 2006 11:36:12 +0000 (+0000) Subject: Fixed two memory leaks in ecpglib. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=5bde1e64e114402aef40a2e36c566cf48aff4e21;p=users%2Fbernd%2Fpostgres.git Fixed two memory leaks in ecpglib. --- diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c index 201fe9ee7d..b80c6a064f 100644 --- a/src/interfaces/ecpg/ecpglib/data.c +++ b/src/interfaces/ecpg/ecpglib/data.c @@ -442,6 +442,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); } @@ -455,6 +456,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: @@ -489,6 +492,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); } @@ -499,6 +503,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)