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.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to