1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-18 12:22:09 +03:00

Fixed memory leak bugs found by Martijn Oosterhout.

This commit is contained in:
Michael Meskes
2006-04-24 09:45:57 +00:00
parent 8f7fce2fd6
commit 46942e84d9
3 changed files with 8 additions and 14 deletions

View File

@@ -164,9 +164,7 @@ ecpg_strndup(const char *str, size_t len)
int
deccvasc(char *cp, int len, decimal *np)
{
char *str = ecpg_strndup(cp, len); /* decimal_in always
* converts the complete
* string */
char *str;
int ret = 0;
numeric *result;
@@ -174,6 +172,7 @@ deccvasc(char *cp, int len, decimal *np)
if (risnull(CSTRINGTYPE, cp))
return 0;
str = ecpg_strndup(cp, len); /* decimal_in always converts the complete string */
if (!str)
ret = ECPG_INFORMIX_NUM_UNDERFLOW;
else

View File

@@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38.4.3 2005/11/30 12:51:06 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38.4.4 2006/04/24 09:45:57 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
@@ -869,7 +869,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
if (var->arrsize > 1)
{
for (element = 0; element < var->arrsize; element++)
for (element = 0; element < var->arrsize; element++, nval = PGTYPESnumeric_new())
{
if (var->type == ECPGt_numeric)
PGTYPESnumeric_copy((numeric *) ((var + var->offset * element)->value), nval);

View File

@@ -363,9 +363,6 @@ PGTYPESnumeric_from_asc(char *str, char **endptr)
numeric *value = (numeric *) pgtypes_alloc(sizeof(numeric));
int ret;
#if 0
long typmod = -1;
#endif
char *realptr;
char **ptr = (endptr != NULL) ? endptr : &realptr;
@@ -374,13 +371,11 @@ PGTYPESnumeric_from_asc(char *str, char **endptr)
ret = set_var_from_str(str, ptr, value);
if (ret)
{
free(value);
return (NULL);
}
#if 0
ret = apply_typmod(value, typmod);
if (ret)
return (NULL);
#endif
return (value);
}