aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2006-06-25 10:00:11 +0000
committerMichael Meskes <meskes@postgresql.org>2006-06-25 10:00:11 +0000
commitb4595d71f2a7f1c33c74a28721c4dff95118b3ce (patch)
tree5e87c1befe1fad88fe27a80584c3547c0b541899 /src/interfaces/ecpg/ecpglib/execute.c
parentbd7f34ba788e619dd6a5589be61fc94bfd5e426a (diff)
downloadpostgresql-b4595d71f2a7f1c33c74a28721c4dff95118b3ce.tar.gz
postgresql-b4595d71f2a7f1c33c74a28721c4dff95118b3ce.zip
Moved some free() calls that coverity correctly complains about.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index ff92354be13..bc2300e5fa1 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38.4.6 2006/06/21 11:38:35 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38.4.7 2006/06/25 10:00:11 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
@@ -900,7 +900,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + sizeof("array [] "), lineno)))
{
PGTYPESnumeric_free(nval);
- free(str);
+ ECPGfree(str);
return false;
}
@@ -909,8 +909,9 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
strcpy(mallocedval + strlen(mallocedval), ",");
+ ECPGfree(str);
+ PGTYPESnumeric_free(nval);
}
- PGTYPESnumeric_free(nval);
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
}
else
@@ -933,12 +934,12 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
strncpy(mallocedval, str, slen);
mallocedval[slen] = '\0';
+ ECPGfree(str);
+ PGTYPESnumeric_free(nval);
}
*tobeinserted_p = mallocedval;
*malloced_p = true;
- PGTYPESnumeric_free(nval);
- free(str);
}
break;
@@ -968,6 +969,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
strcpy(mallocedval + strlen(mallocedval), "interval ");
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
strcpy(mallocedval + strlen(mallocedval), ",");
+ ECPGfree(str);
}
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
}
@@ -987,11 +989,11 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
strcpy(mallocedval, "interval ");
/* also copy trailing '\0' */
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
+ ECPGfree(str);
}
*tobeinserted_p = mallocedval;
*malloced_p = true;
- ECPGfree(str);
}
break;
@@ -1168,6 +1170,7 @@ ECPGexecute(struct statement * stmt)
if (desc == NULL)
{
ECPGraise(stmt->lineno, ECPG_UNKNOWN_DESCRIPTOR, ECPG_SQLSTATE_INVALID_SQL_DESCRIPTOR_NAME, var->pointer);
+ ECPGfree(copiedquery);
return false;
}
@@ -1199,7 +1202,10 @@ ECPGexecute(struct statement * stmt)
desc_inlist.ind_offset = 0;
}
if (!ECPGstore_input(stmt->lineno, stmt->force_indicator, &desc_inlist, &tobeinserted, &malloced))
+ {
+ ECPGfree(copiedquery);
return false;
+ }
break;
}