[MDEV-18376] Memory leak in main.mysqladmin Created: 2019-01-25  Updated: 2019-03-06  Resolved: 2019-03-06

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.2.23, 10.3.14, 10.4.4

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: ASAN, leak


 Description   

If you use cmake -DWITH_SAFEMALLOC=OFF -DWITH_ASAN=ON and run the following:

ASAN_OPTIONS=abort_on_error=1 ./mtr main.mysqladmin

then it will fail with the following:

10.3 e9ba165bcbb9b913411b9a366a5f21d18e313de2

CURRENT_TEST: main.mysqladmin
mysqltest: At line 16: command "$MYSQLADMIN --database=db1 --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root --password= ping 2>&1" failed with wrong error: 134

If you change the 2> redirect to a file, then that file will contain the following:

10.3 e9ba165bcbb9b913411b9a366a5f21d18e313de2

/dev/shm/10.3/client/mysqladmin: unknown variable 'database=db1'
 
=================================================================
==6524==ERROR: LeakSanitizer: detected memory leaks
 
Direct leak of 120 byte(s) in 1 object(s) allocated from:
    #0 0x4c8a7a in calloc (/dev/shm/10.3/client/mysqladmin+0x4c8a7a)
    #1 0x50acdf in mysql_init /mariadb/10.3/libmariadb/libmariadb/mariadb_lib.c:994:27
    #2 0x7f070a53409a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
 
Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x4c8a7a in calloc (/dev/shm/10.3/client/mysqladmin+0x4c8a7a)
    #1 0x50acb0 in mysql_init /mariadb/10.3/libmariadb/libmariadb/mariadb_lib.c:992:32
    #2 0x7f070a53409a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
 
SUMMARY: AddressSanitizer: 124 byte(s) leaked in 2 allocation(s).
Aborted


Generated at Thu Feb 08 08:43:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.