mirror of
https://github.com/postgres/postgres.git
synced 2025-05-17 06:41:24 +03:00
Fixed two memory leaks in ecpglib.
This commit is contained in:
parent
c8fc48e257
commit
8fc6b3dbf3
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.20.2.2 2005/08/24 10:35:54 meskes Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.20.2.3 2006/06/06 11:36:00 meskes Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
@ -426,6 +426,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
|
|
||||||
if (garbage_left(isarray, scan_length, compat))
|
if (garbage_left(isarray, scan_length, compat))
|
||||||
{
|
{
|
||||||
|
free(nres);
|
||||||
ECPGraise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
ECPGraise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
@ -438,6 +439,8 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
PGTYPESnumeric_copy(nres, (numeric *) (var + offset * act_tuple));
|
PGTYPESnumeric_copy(nres, (numeric *) (var + offset * act_tuple));
|
||||||
else
|
else
|
||||||
PGTYPESnumeric_to_decimal(nres, (decimal *) (var + offset * act_tuple));
|
PGTYPESnumeric_to_decimal(nres, (decimal *) (var + offset * act_tuple));
|
||||||
|
|
||||||
|
free(nres);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ECPGt_interval:
|
case ECPGt_interval:
|
||||||
@ -469,6 +472,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
|
|
||||||
if (garbage_left(isarray, scan_length, compat))
|
if (garbage_left(isarray, scan_length, compat))
|
||||||
{
|
{
|
||||||
|
free(ires);
|
||||||
ECPGraise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
ECPGraise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
@ -478,6 +482,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
ires = PGTYPESinterval_from_asc("0 seconds", NULL);
|
ires = PGTYPESinterval_from_asc("0 seconds", NULL);
|
||||||
|
|
||||||
PGTYPESinterval_copy(ires, (interval *) (var + offset * act_tuple));
|
PGTYPESinterval_copy(ires, (interval *) (var + offset * act_tuple));
|
||||||
|
free(ires);
|
||||||
break;
|
break;
|
||||||
case ECPGt_date:
|
case ECPGt_date:
|
||||||
if (pval)
|
if (pval)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user