diff --git a/dlg_wingui.c b/dlg_wingui.c index e47f9bd..700db93 100644 --- a/dlg_wingui.c +++ b/dlg_wingui.c @@ -830,8 +830,10 @@ MYLOG(0, "entering\n"); void *PQconninfoParse(const char *, char **); void PQconninfoFree(void *); +void PQfreemem(void *ptr); typedef void *(*PQCONNINFOPARSEPROC)(const char *, char **); typedef void (*PQCONNINFOFREEPROC)(void *); +typedef void (*PQFREEMEMPROC)(void *); static int ds_options3_update(HWND hdlg, ConnInfo *ci) { @@ -841,6 +843,7 @@ ds_options3_update(HWND hdlg, ConnInfo *ci) HMODULE hmodule; PQCONNINFOPARSEPROC pproc = NULL; PQCONNINFOFREEPROC fproc = NULL; + PQFREEMEMPROC fmproc = NULL; MYLOG(0, "entering got ci=%p\n", ci); @@ -854,8 +857,10 @@ ds_options3_update(HWND hdlg, ConnInfo *ci) const char *logmsg = "libpq parameter error"; MessageBox(hdlg, ermsg ? ermsg : "memory over?", logmsg, MB_ICONEXCLAMATION | MB_OK); - if (NULL != ermsg) - free(ermsg); + if (NULL != ermsg) { + fmproc = (PQFREEMEMPROC)GetProcAddress(hmodule, "PQfreemem"); + (*fmproc)(ermsg); + } FreeLibrary(hmodule); return 1;