postgres.git / summary / log / commit / refs
commit ca6667fef08c1a291756203c14ae72ed35c0b7f1
Author: Michael Meskes <meskes@postgresql.org>
Date: Wed Jun 21 11:38:35 2006 +0000
First released in: 8.2.0, 8.0.9, 8.1.5
Added some more coverity report patches send in by Martijn van Oosterhout <kleptog@svana.org>.
src/interfaces/ecpg/ecpglib/connect.c | 5 ++++-
src/interfaces/ecpg/ecpglib/execute.c | 4 ++--
src/interfaces/ecpg/ecpglib/misc.c | 4 ++--
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c
index 985b18d311a..5e43e8e3839 100644
--- a/src/interfaces/ecpg/ecpglib/connect.c
+++ b/src/interfaces/ecpg/ecpglib/connect.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.24.4.4 2006/06/21 10:31:45 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.24.4.5 2006/06/21 11:38:35 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -222,6 +222,9 @@ ECPGnoticeReceiver(void *arg, const PGresult *result)
if (sqlstate == NULL)
sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR;
+ if (message == NULL) /* Shouldn't happen, but need to be sure */
+ message = "No message received";
+
/* these are not warnings */
if (strncmp(sqlstate, "00", 2) == 0)
return;
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 1e71083fc1a..ff92354be13 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.5 2006/06/21 10:31:45 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38.4.6 2006/06/21 11:38:35 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
@@ -895,7 +895,6 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
PGTYPESnumeric_from_decimal((decimal *) ((var + var->offset * element)->value), nval);
str = PGTYPESnumeric_to_asc(nval, nval->dscale);
- PGTYPESnumeric_free(nval);
slen = strlen(str);
if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + sizeof("array [] "), lineno)))
@@ -911,6 +910,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
strcpy(mallocedval + strlen(mallocedval), ",");
}
+ PGTYPESnumeric_free(nval);
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
}
else
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index a0998c3bda3..bb9725730b3 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.24.4.1 2005/09/12 11:58:33 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.24.4.2 2006/06/21 11:38:35 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -181,7 +181,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
if (!ECPGinit(con, connection_name, lineno))
return (false);
- ECPGlog("ECPGtrans line %d action = %s connection = %s\n", lineno, transaction, con->name);
+ ECPGlog("ECPGtrans line %d action = %s connection = %s\n", lineno, transaction, con ? con->name : "(nil)");
/* if we have no connection we just simulate the command */
if (con && con->connection)
[parent: 289a3b73e271]