diff options
author | Michael Meskes <meskes@postgresql.org> | 2006-06-19 09:19:49 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2006-06-19 09:19:49 +0000 |
commit | aaf125f8df2d93bd5eccf07dbbd4027914661975 (patch) | |
tree | 9841f97db68681687e91eae07c805a53edfab14f | |
parent | b13c9686d08411a284afeb881b49d7955761d8cb (diff) | |
download | postgresql-aaf125f8df2d93bd5eccf07dbbd4027914661975.tar.gz postgresql-aaf125f8df2d93bd5eccf07dbbd4027914661975.zip |
Do not use already free'ed errmsg, bug found by Joachim Wieland
<joachim.wieland@credativ.de>
-rw-r--r-- | src/interfaces/ecpg/ChangeLog | 17 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/connect.c | 11 |
2 files changed, 19 insertions, 9 deletions
diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 44fab3b4540..7cf7c104e84 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -1996,15 +1996,24 @@ Tu Feb 7 18:48:14 CET 2006 Fri, 17 Mar 2006 16:38:19 +0100 - - Fixed bug 2330: Wrong error code in case of a duplicate key + - Fixed bug 2330: Wrong error code in case of a duplicate key. Mo Apr 24 11:40:05 CEST 2006 - Fixed memory leak bugs found by Martijn Oosterhout. -Mi Mai 31 10:10:36 CEST 2006 +We Mai 31 10:10:36 CEST 2006 - - Fixed PGTYPESdate_from_timestamp because some characters got lost there + - Fixed PGTYPESdate_from_timestamp because some characters got lost there. + +Tu Jun 6 12:09:56 CEST 2006 + + - Fixed two more memory leaks in ecpglib. + - Synced parser. + +Mo Jun 19 11:15:50 CEST 2006 + + - Do not use already free'ed errmsg, bug found by Joachim Wieland + <joachim.wieland@credativ.de> - Set ecpg library version to 5.2. - Set ecpg version to 4.2.1. - diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index b5e023dcadc..b3209db5cd2 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.27 2005/11/30 12:49:49 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.28 2006/06/19 09:19:49 meskes Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -456,10 +456,6 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p const char *errmsg = PQerrorMessage(this->connection); char *db = realname ? realname : "<DEFAULT>"; - ecpg_finish(this); -#ifdef ENABLE_THREAD_SAFETY - pthread_mutex_unlock(&connections_mutex); -#endif ECPGlog("connect: could not open database %s on %s port %s %s%s%s%s in line %d\n\t%s\n", db, host ? host : "<DEFAULT>", @@ -468,6 +464,11 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p user ? "for user " : "", user ? user : "", lineno, errmsg); + ecpg_finish(this); +#ifdef ENABLE_THREAD_SAFETY + pthread_mutex_unlock(&connections_mutex); +#endif + ECPGraise(lineno, ECPG_CONNECT, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, db); if (host) ECPGfree(host); |