From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Sascha Demetrio <sd(at)b-comp(dot)de> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: MM Bug in libecpg |
Date: | 2001-10-05 16:29:43 |
Message-ID: | 200110051629.f95GThe23910@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Patch applied. Thanks.
> 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;
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-10-05 17:45:18 | Re: natural join kills postmaster |
Previous Message | pgsql-bugs | 2001-10-05 15:13:14 | Bug #475: "hard coded" tk.h search |