Message-ID: From: "siga0984 (@siga0984)" To: "postgresql-interfaces/psqlodbc" Date: Wed, 25 Sep 2024 02:36:29 +0000 Subject: [postgresql-interfaces/psqlodbc] issue #47: Memory Corruption using version 16.00.0005 List-Id: X-GitHub-Author-Id: 11068123 X-GitHub-Author-Login: siga0984 X-GitHub-Issue: 47 X-GitHub-Repo: postgresql-interfaces/psqlodbc X-GitHub-State: closed X-GitHub-Type: issue X-GitHub-Url: https://github.com/postgresql-interfaces/psqlodbc/issues/47 Content-Type: text/plain; charset=utf-8 After upgrade from ODBC driver 15 to 16, in a c/cpp db gateway program , when the program closes all opened statements, windows CRT crashes with a heap corruption exception, allways when I call SQLFreeHandle of the same ( trivial ) statement. This is the clal stack : psqlodbc30a.dll!TI_ClearObject(TABLE_INFO * ti) Line 66 C [Inline Frame] psqlodbc30a.dll!TI_Destructor(TABLE_INFO * * ti, int count) Line 44 C psqlodbc30a.dll!SC_initialize_cols_info(StatementClass_ * stmt, int DCdestroy, int parseReset) Line 524 C psqlodbc30a.dll!SC_Destructor(StatementClass_ * self) Line 514 C psqlodbc30a.dll!PGAPI_FreeStmt(void * hstmt, unsigned short fOption) Line 334 C psqlodbc30a.dll!SQLFreeHandle(short HandleType, void * Handle) Line 273 C After turn on all odbc logs, the last instructions show some reference count below zero, but the previous count shows positive.. see TI_ClearObject 0000021A4F80E580 refcnt ``` [23924-25.444] qresult.c[QR_Destructor]354: entering [23924-25.444] qresult.c[QR_close_result]265: entering [23924-25.444] qresult.c[QR_free_memory]489: entering fcount=0 [23924-25.444] qresult.c[QR_free_memory]587: leaving [23924-25.444] qresult.c[QR_close_result]329: leaving [23924-25.444] qresult.c[QR_Destructor]358: leaving **[23924-25.444]descriptor[TI_ClearObject]58: !!!refcnt 0000021A4F80E580:2 -> 1** [23924-25.444] qresult.c[QR_Destructor]354: entering [23924-25.444] qresult.c[QR_close_result]265: entering [23924-25.444] qresult.c[QR_free_memory]489: entering fcount=8 [23924-25.444] qresult.c[QR_free_memory]587: leaving [23924-25.444] qresult.c[QR_close_result]329: leaving [23924-25.444] qresult.c[QR_Destructor]358: leaving [23924-25.444] bind.c[reset_a_column_binding]772: entering ... self=0000021A4FA34820, bindings_allocated=1, icol=1 [23924-25.444] bind.c[APD_free_params]643: entering self=0000021A4FA34900 [23924-25.444] bind.c[IPD_free_params]698: entering self=0000021A4FA34970 [23924-25.444] bind.c[PDATA_free_params]663: entering self=0000021A4FA34A68 [23924-25.444]statement.[SC_Destructor]536: leaving [23924-25.444]odbcapi30.[SQLFreeHandle]250: Entering [23924-25.444]statement.[PGAPI_FreeStmt]248: entering...hstmt=0000021A4F7A4050, fOption=1 [23924-25.444] qresult.c[QR_Destructor]354: entering [23924-25.444]statement.[SC_init_Result]546: leaving(0000021A4F7A4050) [23924-25.444]statement.[SC_Destructor]488: entering self=0000021A4F7A4050, self->result=0000000000000000, self->hdbc=0000021A4F6C5700 [23924-25.444]connection[CC_send_query_append]1816: conn=0000021A4F6C5700, query='DEALLOCATE "_PLAN0000021A4F7A4050"' [23924-25.444]connection[CC_send_query_append]1898: query_len=34 [23924-25.444]connection[CC_send_query_append]1942: [QLOG]PQsendQuery: 0000021A4F6BB4F0 'DEALLOCATE "_PLAN0000021A4F7A4050"' [23924-25.444] qresult.c[QR_Constructor]183: entering [23924-25.444] qresult.c[QR_Constructor]252: leaving 0000021A5093DBF0 [23924-25.444]connection[CC_send_query_append]1984: [QLOG] ok: - 'C' - DEALLOCATE [23924-25.444]connection[CC_send_query_append]2000: setting cmdbuffer = 'DEALLOCATE' [23924-25.444]connection[CC_send_query_append]2084: returning res = 0000021A5093DBF0 [23924-25.444] qresult.c[QR_Destructor]354: entering [23924-25.444] qresult.c[QR_close_result]265: entering [23924-25.444] qresult.c[QR_free_memory]489: entering fcount=0 [23924-25.444] qresult.c[QR_free_memory]587: leaving [23924-25.444] qresult.c[QR_close_result]329: leaving [23924-25.444] qresult.c[QR_Destructor]358: leaving **[23924-25.444]descriptor[TI_ClearObject]58: !!!refcnt 0000021A4F80E580:0 -> -1** ``` And this is the last line on file ... I don't know is this is the proper channel to report or ask help for something like this ... The application runs the same (huge) sequence of instructions with all previous versions of odbc driver ... any tips, advice, I will appreciate !!