mirror of
https://github.com/postgres/postgres.git
synced 2025-05-17 06:41:24 +03:00
Do not use already free'ed errmsg, bug found by Joachim Wieland
<joachim.wieland@credativ.de>
This commit is contained in:
parent
8fc6b3dbf3
commit
9e6815ef0f
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.17.2.1 2003/11/24 13:11:27 petere Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.17.2.2 2006/06/19 09:20:32 meskes Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
@ -386,10 +386,6 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
|
|||||||
const char *errmsg = PQerrorMessage(this->connection);
|
const char *errmsg = PQerrorMessage(this->connection);
|
||||||
char *db = realname ? realname : "<DEFAULT>";
|
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",
|
ECPGlog("connect: could not open database %s on %s port %s %s%s%s%s in line %d\n\t%s\n",
|
||||||
db,
|
db,
|
||||||
host ? host : "<DEFAULT>",
|
host ? host : "<DEFAULT>",
|
||||||
@ -398,6 +394,11 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
|
|||||||
user ? "for user " : "", user ? user : "",
|
user ? "for user " : "", user ? user : "",
|
||||||
lineno, errmsg);
|
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);
|
ECPGraise(lineno, ECPG_CONNECT, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, db);
|
||||||
if (host)
|
if (host)
|
||||||
ECPGfree(host);
|
ECPGfree(host);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user