From fa3d209d87e9281f2d866a2bfa1c8491a2b551ca Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Fri, 28 Jul 2006 11:49:36 +0000 Subject: [PATCH] Variables should be free'ed only once. --- src/interfaces/ecpg/ChangeLog | 3 ++- src/interfaces/ecpg/ecpglib/execute.c | 16 +++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 0bfe3ef928..80d9ebc3fa 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -2043,7 +2043,7 @@ Mo Jun 26 16:08:23 CEST 2006 We Jul 5 12:17:28 CEST 2006 - - Fixed remaining Coverity bugs. + - Fixed most of the remaining Coverity bugs. Fr Jul 28 11:00:51 CEST 2006 @@ -2051,5 +2051,6 @@ Fr Jul 28 11:00:51 CEST 2006 - SHOW statement puts result into a variable - COPY TO STDOUT works - Connection identifier has to be unique + - Variables should be free'ed only once. - Set ecpg library version to 5.2. - Set ecpg version to 4.2.1. diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index 88b91193ec..66ffe23c52 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -1049,19 +1049,14 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia case ECPGt_timestamp: { - char *str = NULL, *asc = NULL; + char *str = NULL; int slen; if (var->arrsize > 1) { for (element = 0; element < var->arrsize; element++) { - asc = PGTYPEStimestamp_to_asc(*(timestamp *) ((var + var->offset * element)->value)); - if (!asc) - return false; - - str = quote_postgres(asc, lineno); - ECPGfree(asc); /* we don't need this anymore so free it asap. */ + str = quote_postgres(PGTYPEStimestamp_to_asc(*(timestamp *) ((var + var->offset * element)->value)), lineno); if (!str) return false; @@ -1084,12 +1079,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia } else { - asc = PGTYPEStimestamp_to_asc(*(timestamp *) (var->value)); - if (!asc) - return false; - - str = quote_postgres(asc, lineno); - ECPGfree(asc); /* we don't need this anymore so free it asap. */ + str = quote_postgres(PGTYPEStimestamp_to_asc(*(timestamp *) (var->value)), lineno); if (!str) return false; slen = strlen(str); -- 2.39.5