[ODBC-389] alloc-dealloc-mismatch in MADB_DbcFree Created: 2023-04-27  Updated: 2023-04-28  Resolved: 2023-04-28

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.2.0
Fix Version/s: 3.2.1

Type: Bug Priority: Major
Reporter: markus makela Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None


 Description   

Reported by ASAN when used by MaxScale. Here's the relevant parts of the ASAN report:

==232127==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) on 0x618000060080
2023-04-26 16:34:03   info   : Accept authentication from 'admin', using password. Request: /v1/sql/d445c898-631d-436a-b565-f6982359e47f/queries/d445c898-631d-436a-b565-f6982359e47f.1/
    #0 0x7fb9009937e0 in __interceptor_free (/lib64/libasan.so.5+0xef7e0)
    #1 0x7fb8eddba633 in MADB_DbcFree(MADB_Dbc*) /home/buildbot/src/driver/ma_connection.cpp:563
    #2 0x7fb8eddb4609 in MA_SQLFreeHandle(short, void*) /home/buildbot/src/driver/ma_api_internal.cpp:963
    #3 0x7fb8fec3db03  (/lib64/libodbc.so.2+0xfb03)
    #4 0x7fb8fec4174c in SQLDisconnect (/lib64/libodbc.so.2+0x1374c)
0x618000060080 is located 0 bytes inside of 856-byte region [0x618000060080,0x6180000603d8)
allocated by thread T9 here:
    #0 0x7fb9009957b0 in operator new(unsigned long) (/lib64/libasan.so.5+0xf17b0)
    #1 0x7fb8eddbc638 in MADB_DbcInit(st_ma_odbc_environment*) /home/buildbot/src/driver/ma_connection.cpp:2381



 Comments   
Comment by Lawrin Novitsky [ 2023-04-28 ]

Connection handle has been changed to be allocated with new, but deallocation has been remaining old free, instead of delete

Generated at Thu Feb 08 03:28:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.