Re: BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions - Mailing list pgsql-bugs

From Benjamin Wassermann
Subject Re: BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions
Date
Msg-id 1381753906060-5774487.post@n5.nabble.com
Whole thread Raw
In response to BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions  (benny@hegne.de)
Responses Re: BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions  (Marko Tiikkaja <marko@joh.to>)
Re: BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions  (Bruce Momjian <bruce@momjian.us>)
List 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.

pgsql-bugs by date:

Previous
From: Greg Stark
Date:
Subject: Re: BUG #8515: Random 'relation "..." does not exist'
Next
From: Marko Tiikkaja
Date:
Subject: Re: BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions