]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Added some more coverity report patches send in by Martijn van Oosterhout <kleptog...
authorMichael Meskes <meskes@postgresql.org>
Wed, 21 Jun 2006 11:38:35 +0000 (11:38 +0000)
committerMichael Meskes <meskes@postgresql.org>
Wed, 21 Jun 2006 11:38:35 +0000 (11:38 +0000)
src/interfaces/ecpg/ecpglib/connect.c
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/misc.c

index 985b18d311afa77bfe1ae0872aeb510bb9fdfbb5..5e43e8e3839dd9c5a71b94ffe678201ae9bb4a83 100644 (file)
@@ -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;
index 1e71083fc1a94969a351cbe98eb1d76e852ccd86..ff92354be134e9f28f549da4ebd7dc843ae84b7f 100644 (file)
@@ -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
index a0998c3bda3566dd55897c59984e8dd8b400e0e7..bb9725730b39e3d52c9bc63d82831f17b84eb0c6 100644 (file)
@@ -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)