Comment 10 for bug 1877504

Attached is a new reproducer that just uses the libmysqlclient directly without using Qt.

It's based on an example from a zetcode tutorial.

I used this to compile it :-
gcc mysql_test.c -o mysql_test -I/usr/include `mysql_config --cflags --libs`

The interesting thing is if you comment out both mysql_server_end() and mysql_library_end() at the bottom of the example it works without segfault. Uncomment either call and it will segfault.

The mysql docs say mysql_server_end() is depreciated and new code should use mysql_library_end() but they both cause a segfault. Ref:

This is the bt with debugging symbols installed for libmysqlclient which is a little more informative and should help a MySQL dev pinpoint the problem.

(gdb) bt
#0 0x00007ffff793823f in charset_uninit () at ./mysys/
#1 0x00007ffff793d753 in my_end (infoflag=infoflag@entry=0) at ./mysys/
#2 0x00007ffff78db173 in mysql_server_end () at ./libmysql/
#3 0x00005555555554f0 in main ()

I'll also attached a bt with bt full in case it's useful.