Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit aaf125f

Browse files
author
Michael Meskes
committed
Do not use already free'ed errmsg, bug found by Joachim Wieland
<joachim.wieland@credativ.de>
1 parent b13c968 commit aaf125f

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/interfaces/ecpg/ChangeLog

+13-4
Original file line numberDiff line numberDiff line change
@@ -1996,15 +1996,24 @@ Tu Feb 7 18:48:14 CET 2006
19961996

19971997
Fri, 17 Mar 2006 16:38:19 +0100
19981998

1999-
- Fixed bug 2330: Wrong error code in case of a duplicate key
1999+
- Fixed bug 2330: Wrong error code in case of a duplicate key.
20002000

20012001
Mo Apr 24 11:40:05 CEST 2006
20022002

20032003
- Fixed memory leak bugs found by Martijn Oosterhout.
20042004

2005-
Mi Mai 31 10:10:36 CEST 2006
2005+
We Mai 31 10:10:36 CEST 2006
20062006

2007-
- Fixed PGTYPESdate_from_timestamp because some characters got lost there
2007+
- Fixed PGTYPESdate_from_timestamp because some characters got lost there.
2008+
2009+
Tu Jun 6 12:09:56 CEST 2006
2010+
2011+
- Fixed two more memory leaks in ecpglib.
2012+
- Synced parser.
2013+
2014+
Mo Jun 19 11:15:50 CEST 2006
2015+
2016+
- Do not use already free'ed errmsg, bug found by Joachim Wieland
2017+
<joachim.wieland@credativ.de>
20082018
- Set ecpg library version to 5.2.
20092019
- Set ecpg version to 4.2.1.
2010-

src/interfaces/ecpg/ecpglib/connect.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.27 2005/11/30 12:49:49 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.28 2006/06/19 09:19:49 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -456,10 +456,6 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
456456
const char *errmsg = PQerrorMessage(this->connection);
457457
char *db = realname ? realname : "<DEFAULT>";
458458

459-
ecpg_finish(this);
460-
#ifdef ENABLE_THREAD_SAFETY
461-
pthread_mutex_unlock(&connections_mutex);
462-
#endif
463459
ECPGlog("connect: could not open database %s on %s port %s %s%s%s%s in line %d\n\t%s\n",
464460
db,
465461
host ? host : "<DEFAULT>",
@@ -468,6 +464,11 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
468464
user ? "for user " : "", user ? user : "",
469465
lineno, errmsg);
470466

467+
ecpg_finish(this);
468+
#ifdef ENABLE_THREAD_SAFETY
469+
pthread_mutex_unlock(&connections_mutex);
470+
#endif
471+
471472
ECPGraise(lineno, ECPG_CONNECT, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, db);
472473
if (host)
473474
ECPGfree(host);

0 commit comments

Comments
 (0)