]> granicus.if.org Git - postgresql/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:07 +0000 (11:38 +0000)
committerMichael Meskes <meskes@postgresql.org>
Wed, 21 Jun 2006 11:38:07 +0000 (11:38 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ecpglib/connect.c
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/misc.c

index 9a7d7586326dcad3632c660b38852ec87cc8d29e..9ddb041087b3a1fb9d4f1060b5b0a1972687c923 100644 (file)
@@ -2021,5 +2021,10 @@ We Jun 21 09:24:53 CEST 2006
        - Added fixes from the coverity report send in by Joachim Wieland
          <joe@mcknight.de>.
        - Added missing error handling in a few functions in ecpglib.
+
+we Jun 21 13:37:00 CEST 2006
+
+       - Added some more coverity report patches send in by Martijn van
+         Oosterhout <kleptog@svana.org>.
        - Set ecpg library version to 5.2.
        - Set ecpg version to 4.2.1.
index 5de287c973b8cb6339e0c4f6614c17167ea78e29..3cba42d25ff6b200bf6a295b739a299d413c0bb4 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.29 2006/06/21 10:24:40 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.30 2006/06/21 11:38:07 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -227,6 +227,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 c2ff9b6de92c61a366d38762eaf673844959d490..fc2af97547012f6608c93a7746c3c9a807c646be 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.47 2006/06/21 10:24:40 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.48 2006/06/21 11:38:07 meskes Exp $ */
 
 /*
  * 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
                                                                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)))
@@ -907,6 +906,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 ff38bfab799a8739cd9f3e23a3216dc3591b817e..fbe02bac10dcb5b2ff663fd254b02f0cd6122fbc 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.26 2005/10/15 02:49:47 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.27 2006/06/21 11:38:07 meskes Exp $ */
 
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
@@ -179,7 +179,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)