RE: libpq @windows : leaked singlethread_lock makes AppVerifier unhappy - Mailing list pgsql-hackers

From Першин Юрий Петрович
Subject RE: libpq @windows : leaked singlethread_lock makes AppVerifier unhappy
Date
Msg-id c05d588c78d941b782c0c452f09f1a58@prosoftsystems.ru
Whole thread Raw
In response to libpq @windows : leaked singlethread_lock makes AppVerifier unhappy  (Першин Юрий Петрович <pershin@prosoftsystems.ru>)
List pgsql-hackers

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                     }

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Proposed patch for key managment
Next
From: Justin Pryzby
Date:
Subject: v10 release notes for extended stats