Re: BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions

From: Benjamin Wassermann <benny(at)hegne(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions
Date: 2013-10-14 12:31:46
Message-ID: 1381753906060-5774487.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

We finally find out why this problem occurs.

PG_dump use some Functions like
initPQExpBuffer(..)
from the libpq.dll.

In this function "initPQExpBuffer(...)" are some memory allocated with
malloc(...).
(File: "pg_dump.c", line 9366)

After the function is successfully dumped to backup file, there is a
"free(...)" in Function "dumpFunc" at line 9942 ff.
...
free(funcsig);
...

but the PG_dump.exe cant free memory which is allocated by libpq.dll.

To fix this problem the "libpq.dll" need a new function named
"deletePQCharPointer()"

File: "pqexpbuffer.h"
Line: 188

> extern void deletePQCharPointer(char *pointer);

The definition of the function is:

File: "pqexpbuffer.c"
Line: 378

> void
> deletePQCharPointer(char *pointer)
> {
> if (pointer)
> {
> free(pointer);
> }
> }

Then add the function to the exported functions in the def files

File: "libpqddll.def"
Line: 169

> deletePQCharPointer @ 166

File: "blibpqdll.def"
Line: 169

> _deletePQCharPointer @ 166

File: "blibpqdll.def"
Line: 337

> deletePQCharPointer = _deletePQCharPointer

We have successfully tested the new function and it would be nice if this is
in a future release of postgresql ;)

Regards
Ben

--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-8461-PostgreSQL-9-3-pg-dump-heap-corruptions-tp5771445p5774487.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Marko Tiikkaja 2013-10-14 13:23:51 Re: BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions
Previous Message Greg Stark 2013-10-14 02:56:37 Re: BUG #8515: Random 'relation "..." does not exist'