diff options
author | Michael Meskes <meskes@postgresql.org> | 2006-06-25 09:38:40 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2006-06-25 09:38:40 +0000 |
commit | 17bab8c3fe25607758ad8318908ce200f6c909b5 (patch) | |
tree | 49379ecedf3d28d6834aeca1afc115c448b90e17 /src/interfaces/ecpg/ecpglib/execute.c | |
parent | 885a4d3d9acdac41ca52c7ed2d358754549e0e97 (diff) | |
download | postgresql-17bab8c3fe25607758ad8318908ce200f6c909b5.tar.gz postgresql-17bab8c3fe25607758ad8318908ce200f6c909b5.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.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index fc2af975470..4c43195b942 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.48 2006/06/21 11:38:07 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.49 2006/06/25 09:38:39 meskes Exp $ */ /* * The aim is to get a simpler inteface to the database routines. @@ -896,7 +896,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; } @@ -905,8 +905,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 @@ -929,12 +930,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; @@ -964,6 +965,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, "]"); } @@ -983,11 +985,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; @@ -1163,6 +1165,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; } @@ -1194,7 +1197,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; } |