Skip to content

Commit 76475a7

Browse files
author
Michael Meskes
committed
Variables should be free'ed only once.
1 parent a27cb17 commit 76475a7

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,13 +2043,14 @@ Mo Jun 26 16:08:23 CEST 2006
20432043

20442044
We Jul 5 12:17:28 CEST 2006
20452045

2046-
- Fixed remaining Coverity bugs.
2046+
- Fixed most of the remaining Coverity bugs.
20472047

20482048
Fr Jul 28 11:00:51 CEST 2006
20492049

20502050
- Added more SoC changes by Joachim Wieland <joe@mcknight.de>:
20512051
- SHOW statement puts result into a variable
20522052
- COPY TO STDOUT works
20532053
- Connection identifier has to be unique
2054+
- Variables should be free'ed only once.
20542055
- Set ecpg library version to 5.2.
20552056
- Set ecpg version to 4.2.1.

src/interfaces/ecpg/ecpglib/execute.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.54 2006/07/28 10:12:56 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.55 2006/07/28 11:49:36 meskes Exp $ */
22

33
/*
44
* The aim is to get a simpler inteface to the database routines.
@@ -1049,19 +1049,14 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
10491049

10501050
case ECPGt_timestamp:
10511051
{
1052-
char *str = NULL, *asc = NULL;
1052+
char *str = NULL;
10531053
int slen;
10541054

10551055
if (var->arrsize > 1)
10561056
{
10571057
for (element = 0; element < var->arrsize; element++)
10581058
{
1059-
asc = PGTYPEStimestamp_to_asc(*(timestamp *) ((var + var->offset * element)->value));
1060-
if (!asc)
1061-
return false;
1062-
1063-
str = quote_postgres(asc, lineno);
1064-
ECPGfree(asc); /* we don't need this anymore so free it asap. */
1059+
str = quote_postgres(PGTYPEStimestamp_to_asc(*(timestamp *) ((var + var->offset * element)->value)), lineno);
10651060
if (!str)
10661061
return false;
10671062

@@ -1084,12 +1079,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
10841079
}
10851080
else
10861081
{
1087-
asc = PGTYPEStimestamp_to_asc(*(timestamp *) (var->value));
1088-
if (!asc)
1089-
return false;
1090-
1091-
str = quote_postgres(asc, lineno);
1092-
ECPGfree(asc); /* we don't need this anymore so free it asap. */
1082+
str = quote_postgres(PGTYPEStimestamp_to_asc(*(timestamp *) (var->value)), lineno);
10931083
if (!str)
10941084
return false;
10951085
slen = strlen(str);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy