Skip to content

Commit 3f9aace

Browse files
author
Michael Meskes
committed
Added some more coverity report patches send in by Martijn van Oosterhout <kleptog@svana.org>.
1 parent 6bba431 commit 3f9aace

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,5 +2021,10 @@ We Jun 21 09:24:53 CEST 2006
20212021
- Added fixes from the coverity report send in by Joachim Wieland
20222022
<joe@mcknight.de>.
20232023
- Added missing error handling in a few functions in ecpglib.
2024+
2025+
we Jun 21 13:37:00 CEST 2006
2026+
2027+
- Added some more coverity report patches send in by Martijn van
2028+
Oosterhout <kleptog@svana.org>.
20242029
- Set ecpg library version to 5.2.
20252030
- Set ecpg version to 4.2.1.

src/interfaces/ecpg/ecpglib/connect.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.29 2006/06/21 10:24:40 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.30 2006/06/21 11:38:07 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -227,6 +227,9 @@ ECPGnoticeReceiver(void *arg, const PGresult *result)
227227
if (sqlstate == NULL)
228228
sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR;
229229

230+
if (message == NULL) /* Shouldn't happen, but need to be sure */
231+
message = "No message received";
232+
230233
/* these are not warnings */
231234
if (strncmp(sqlstate, "00", 2) == 0)
232235
return;

src/interfaces/ecpg/ecpglib/execute.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.47 2006/06/21 10:24:40 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.48 2006/06/21 11:38:07 meskes Exp $ */
22

33
/*
44
* The aim is to get a simpler inteface to the database routines.
@@ -891,7 +891,6 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
891891
PGTYPESnumeric_from_decimal((decimal *) ((var + var->offset * element)->value), nval);
892892

893893
str = PGTYPESnumeric_to_asc(nval, nval->dscale);
894-
PGTYPESnumeric_free(nval);
895894
slen = strlen(str);
896895

897896
if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + sizeof("array [] "), lineno)))
@@ -907,6 +906,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
907906
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
908907
strcpy(mallocedval + strlen(mallocedval), ",");
909908
}
909+
PGTYPESnumeric_free(nval);
910910
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
911911
}
912912
else

src/interfaces/ecpg/ecpglib/misc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.26 2005/10/15 02:49:47 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.27 2006/06/21 11:38:07 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -179,7 +179,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
179179
if (!ECPGinit(con, connection_name, lineno))
180180
return (false);
181181

182-
ECPGlog("ECPGtrans line %d action = %s connection = %s\n", lineno, transaction, con->name);
182+
ECPGlog("ECPGtrans line %d action = %s connection = %s\n", lineno, transaction, con ? con->name : "(nil)");
183183

184184
/* if we have no connection we just simulate the command */
185185
if (con && con->connection)

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