[bug fix] ECPG: freeing memory for pgtypes crashes on Windows - Mailing list pgsql-hackers

From Tsunakawa, Takayuki
Subject [bug fix] ECPG: freeing memory for pgtypes crashes on Windows
Date
Msg-id 0A3221C70F24FB45833433255569204D1F8AD5D6@G01JPEXMBYT05
Whole thread Raw
Responses Re: [bug fix] ECPG: freeing memory for pgtypes crashes on Windows
List pgsql-hackers
Hello,

Some user hit a problem with ECPG on Windows.  The attached patch is a fix for it.  I'd appreciate it if you could
backportthis in all supported versions.
 

The problem is simple.  free() in the following example crashes:

    char *out;

    out = PGTYPESnumeric_to_asc(...);
    free(out);

The cause is the mismatch of the version of C runtime library.  The version of Visual Studio used to build the
applicationwas different from that for building PostgreSQL (libpgtypes.dll).
 

The fix is to add PGTYPES_free() in libpgtypes.dll, just like libpq has PQfreemem() described here:

https://www.postgresql.org/docs/devel/static/libpq-misc.html


Regards
Takayuki Tsunakawa


Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] generated columns
Next
From: Amit Kapila
Date:
Subject: Re: Wait for parallel workers to attach