Hi
Here is my workaround (from unit_tests.dll DLL_PROCESS_DETACH):
//3. Destroy LIBPQ!static pthread_mutex_t singlethread_lock
- 327 HMODULE hLeakedLibPQ = ::GetModuleHandleA("libpq.dll"); //libpq.dll v13.0.1.20323 (https://ftp.postgresql.org/pub/odbc/versions/msi/psqlodbc_13_00_0000.zip)
- 328 if (hLeakedLibPQ) {
- 329 void **singlethread_lock_ptr = (void **)(((BYTE *)hLeakedLibPQ) +
- 330 #ifdef _WIN64
- 331 0x484b8
- 332 #else
- 333 0x3F26C
- 334 #endif //_WIN64
- 335 );
- 336 if (*singlethread_lock_ptr) {
- 337 DeleteCriticalSection((LPCRITICAL_SECTION)(*singlethread_lock_ptr));
- 338 typedef void(*pthread_mutex_destroy)(void *mutex);
- 339 pthread_mutex_destroy freemtx = (pthread_mutex_destroy)::GetProcAddress(hLeakedLibPQ, "PQfreemem");
- 340 assert(freemtx != NULL);
- 341 if (freemtx) freemtx(*singlethread_lock_ptr);
- 342 }
- 343 }