Added some more coverity report patches send in by Joachim Wieland <joe@mcknight.de>.
This commit is contained in:
parent
bc28f58b8f
commit
ea9ec780ed
@ -2030,5 +2030,10 @@ we Jun 21 13:37:00 CEST 2006
|
|||||||
Su Jun 25 11:27:46 CEST 2006
|
Su Jun 25 11:27:46 CEST 2006
|
||||||
|
|
||||||
- Moved some free() calls that coverity correctly complains about.
|
- Moved some free() calls that coverity correctly complains about.
|
||||||
|
|
||||||
|
Mo Jun 26 11:05:25 CEST 2006
|
||||||
|
|
||||||
|
- Added some more coverity report patches send in by Joachim Wieland
|
||||||
|
<joe@mcknight.de>.
|
||||||
- Set ecpg library version to 5.2.
|
- Set ecpg library version to 5.2.
|
||||||
- Set ecpg version to 4.2.1.
|
- Set ecpg version to 4.2.1.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.45 2006/06/25 01:45:32 momjian Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.46 2006/06/26 09:20:09 meskes Exp $ */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -417,6 +417,7 @@ dectoint(decimal *np, int *ip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = PGTYPESnumeric_to_int(nres, ip);
|
ret = PGTYPESnumeric_to_int(nres, ip);
|
||||||
|
PGTYPESnumeric_free(nres);
|
||||||
|
|
||||||
if (ret == PGTYPES_NUM_OVERFLOW)
|
if (ret == PGTYPES_NUM_OVERFLOW)
|
||||||
ret = ECPG_INFORMIX_NUM_OVERFLOW;
|
ret = ECPG_INFORMIX_NUM_OVERFLOW;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.49 2006/06/25 09:38:39 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.50 2006/06/26 09:20:09 meskes Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The aim is to get a simpler inteface to the database routines.
|
* The aim is to get a simpler inteface to the database routines.
|
||||||
@ -875,16 +875,16 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
|
|||||||
case ECPGt_numeric:
|
case ECPGt_numeric:
|
||||||
{
|
{
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
int slen;
|
int slen;
|
||||||
numeric *nval = PGTYPESnumeric_new();
|
numeric *nval = PGTYPESnumeric_new();
|
||||||
|
|
||||||
if (!nval)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (var->arrsize > 1)
|
if (var->arrsize > 1)
|
||||||
{
|
{
|
||||||
for (element = 0; element < var->arrsize; element++, nval = PGTYPESnumeric_new())
|
for (element = 0; element < var->arrsize; element++, nval = PGTYPESnumeric_new())
|
||||||
{
|
{
|
||||||
|
if (!nval)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (var->type == ECPGt_numeric)
|
if (var->type == ECPGt_numeric)
|
||||||
PGTYPESnumeric_copy((numeric *) ((var + var->offset * element)->value), nval);
|
PGTYPESnumeric_copy((numeric *) ((var + var->offset * element)->value), nval);
|
||||||
else
|
else
|
||||||
@ -892,10 +892,10 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
|
|||||||
|
|
||||||
str = PGTYPESnumeric_to_asc(nval, nval->dscale);
|
str = PGTYPESnumeric_to_asc(nval, nval->dscale);
|
||||||
slen = strlen(str);
|
slen = strlen(str);
|
||||||
|
PGTYPESnumeric_free(nval);
|
||||||
|
|
||||||
if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + sizeof("array [] "), lineno)))
|
if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + sizeof("array [] "), lineno)))
|
||||||
{
|
{
|
||||||
PGTYPESnumeric_free(nval);
|
|
||||||
ECPGfree(str);
|
ECPGfree(str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -906,24 +906,25 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
|
|||||||
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
|
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
|
||||||
strcpy(mallocedval + strlen(mallocedval), ",");
|
strcpy(mallocedval + strlen(mallocedval), ",");
|
||||||
ECPGfree(str);
|
ECPGfree(str);
|
||||||
PGTYPESnumeric_free(nval);
|
|
||||||
}
|
}
|
||||||
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
|
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!nval)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (var->type == ECPGt_numeric)
|
if (var->type == ECPGt_numeric)
|
||||||
PGTYPESnumeric_copy((numeric *) (var->value), nval);
|
PGTYPESnumeric_copy((numeric *) (var->value), nval);
|
||||||
else
|
else
|
||||||
PGTYPESnumeric_from_decimal((decimal *) (var->value), nval);
|
PGTYPESnumeric_from_decimal((decimal *) (var->value), nval);
|
||||||
|
|
||||||
str = PGTYPESnumeric_to_asc(nval, nval->dscale);
|
str = PGTYPESnumeric_to_asc(nval, nval->dscale);
|
||||||
|
|
||||||
slen = strlen(str);
|
slen = strlen(str);
|
||||||
|
PGTYPESnumeric_free(nval);
|
||||||
|
|
||||||
if (!(mallocedval = ECPGalloc(slen + 1, lineno)))
|
if (!(mallocedval = ECPGalloc(slen + 1, lineno)))
|
||||||
{
|
{
|
||||||
PGTYPESnumeric_free(nval);
|
|
||||||
free(str);
|
free(str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -931,7 +932,6 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
|
|||||||
strncpy(mallocedval, str, slen);
|
strncpy(mallocedval, str, slen);
|
||||||
mallocedval[slen] = '\0';
|
mallocedval[slen] = '\0';
|
||||||
ECPGfree(str);
|
ECPGfree(str);
|
||||||
PGTYPESnumeric_free(nval);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*tobeinserted_p = mallocedval;
|
*tobeinserted_p = mallocedval;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user