MM Bug in libecpg
| От | Sascha Demetrio |
|---|---|
| Тема | MM Bug in libecpg |
| Дата | |
| Msg-id | 20010929170034.A7391@gargamel.b-comp.de обсуждение исходный текст |
| Ответы |
Re: MM Bug in libecpg
|
| Список | pgsql-bugs |
Hi,
I'd like to report a bug in the memory management of libecpg
(PostgreSQL version 7.1.3).
The ECPGLog() call in ./src/interfaces/ecpg/lib/connect.c line 428
uses variables pointing to free()'ed storage (`realname', `host',
`port', and `options', see patch below).
regards,
Sascha Demetrio
diff -u connect.c.old connect.c
--- connect.c.old Sat Sep 29 16:51:41 2001
+++ connect.c Sat Sep 29 16:53:03 2001
@@ -411,17 +411,6 @@
this->connection = PQsetdbLogin(host, port, options, NULL, realname, user, passwd);
- if (host)
- free(host);
- if (port)
- free(port);
- if (options)
- free(options);
- if (realname)
- free(realname);
- if (dbname)
- free(dbname);
-
if (PQstatus(this->connection) == CONNECTION_BAD)
{
ecpg_finish(this);
@@ -433,8 +422,31 @@
user ? "for user " : "", user ? user : "",
lineno);
ECPGraise(lineno, ECPG_CONNECT, realname ? realname : "<DEFAULT>");
+
+ if (host)
+ free(host);
+ if (port)
+ free(port);
+ if (options)
+ free(options);
+ if (realname)
+ free(realname);
+ if (dbname)
+ free(dbname);
+
return false;
}
+
+ if (host)
+ free(host);
+ if (port)
+ free(port);
+ if (options)
+ free(options);
+ if (realname)
+ free(realname);
+ if (dbname)
+ free(dbname);
this->committed = true;
this->autocommit = autocommit;
В списке pgsql-bugs по дате отправления: