From: Michael Meskes Date: Wed, 21 Jun 2006 11:38:26 +0000 (+0000) Subject: Added some more coverity report patches send in by Martijn van Oosterhout . --- diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index 841088f99a..6dcd576569 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -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; diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index 532b6f1a2c..1bef722527 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -886,7 +886,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))) @@ -902,6 +901,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 810c28af3d..38f7946984 100644 --- a/src/interfaces/ecpg/ecpglib/misc.c +++ b/src/interfaces/ecpg/ecpglib/misc.c @@ -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)