LP #1604419: Connection option MYSQL_SERVER_PUBLIC_KEY memory leak

Description

**Reported in Launchpad by Laurynas Biveinis last update 21-07-2016 07:17:00

main.plugin_auth_sha256_2 w3 [ fail ]
Test ended at 2016-07-18 10:35:37

CURRENT_TEST: main.plugin_auth_sha256_2
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.

=================================================================
==29446==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 131 byte(s) in 1 object(s) allocated from:
#0 0x7fc6e777e54a in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9854a)
#1 0x4789ce in my_malloc /mnt/workspace/percona-server-5.6-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/mysys/my_malloc.c:38
#2 0x479236 in my_strdup /mnt/workspace/percona-server-5.6-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/mysys/my_malloc.c:158
#3 0x44162a in mysql_options /mnt/workspace/percona-server-5.6-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/sql-common/client.c:4501
#4 0x40d706 in sql_real_connect /mnt/workspace/percona-server-5.6-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysql.cc:4856
#5 0x40d706 in sql_connect /mnt/workspace/percona-server-5.6-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysql.cc:4938
#6 0x416e64 in main /mnt/workspace/percona-server-5.6-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysql.cc:1295
#7 0x7fc6e5b5782f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 131 byte(s) leaked in 1 allocation(s).
mysqltest: At line 10: command "$MYSQL -ukristofer -psecret --default_auth=sha256_password --server_public_key_path=$MYSQL_TEST_DIR/std_data/rsa_public_key.pem -e "select user(), current_user()"" failed

Environment

None

Smart Checklist

Activity

Show:

lpjirasync January 24, 2018 at 9:51 AM

lpjirasync January 24, 2018 at 9:51 AM

**Comment from Launchpad by: Laurynas Biveinis on: 19-07-2016 13:41:16

The fix is to backport

commit 9979e3e4e63d2c1bd64e931318afb1553c38c10c
Author: Rafal Somla <rafal.somla@oracle.com>
Date: Mon Mar 10 18:45:27 2014 +0100

Bug#17933308 - VALGRIND: MEMORY LEAK IN MYSQL_OPTIONS() AND MYSQL_LOAD_PLUGIN_V()

Two leaks fixed:

1. Freeing memory allocated for
mysql->options.extension->server_public_key_path inside
mysql_close_free_options() function.

2. Freeing memory allocated inside a dummy MYSQL connection handle used
by mysql_client_plugin_init() by calling mysql_close_free() at the
end of the function.

Functions mysql_close_free() and mysql_close_free_options() are made available outside the sql-common/client.c file. Also, mysql_close_free() is updated to free memory used by mysql->extension.

Done

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 24, 2018 at 9:51 AM
Updated January 24, 2018 at 9:51 AM
Resolved January 24, 2018 at 9:51 AM