[tasaka1@localhost ruby]$ gdb --args ruby-mri -I. -e 'require "skf" ; Skf.convert("-s", [164, 162].pack("C*"))' GNU gdb (GDB) Fedora 10.1-2.fc33 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ruby-mri... Reading symbols from /usr/lib/debug/usr/bin/ruby-mri-2.7.2-135.fc33.x86_64.debug... (gdb) r Starting program: /usr/bin/ruby-mri -I. -e require\ \"skf\"\ \;\ Skf.convert\(\"-s\",\ \[164,\ 162\].pack\(\"C\*\"\)\) [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". free(): double free detected in tcache 2 Program received signal SIGABRT, Aborted. __GI_raise (sig=) at ../sysdeps/unix/sysv/linux/raise.c:49 49 return ret; Missing separate debuginfos, use: dnf debuginfo-install gmp-6.2.0-5.fc33.x86_64 libxcrypt-4.4.17-1.fc33.x86_64 (gdb) bt #0 __GI_raise (sig=) at ../sysdeps/unix/sysv/linux/raise.c:49 #1 0x00007ffff7aa68a4 in __GI_abort () at abort.c:79 #2 0x00007ffff7afff27 in __libc_message (action=, fmt=) at ../sysdeps/posix/libc_fatal.c:155 #3 0x00007ffff7b07c1c in malloc_printerr (str=str@entry=0x7ffff7c147a8 "free(): double free detected in tcache 2") at malloc.c:5389 #4 0x00007ffff7b096ec in _int_free (av=0x7ffff7c44a00 , p=0x5555557100a0, have_lock=0) at malloc.c:4232 #5 0x00007fffe67a3479 in convert (optstr=optstr@entry=0x5555557501d0, cstr=0x5555557100b0) at skf_convert_f_wrap.c:3168 #6 0x00007fffe67a3517 in _wrap_convert (argc=, argv=0x7fffea1f2048, self=) at skf_convert_f_wrap.c:3486 #7 0x00007ffff7e69692 in vm_call_cfunc_with_frame (empty_kw_splat=, cd=, calling=, reg_cfp=, ec=) at vm_insnhelper.c:2514 #8 vm_call_cfunc (ec=0x55555555b610, reg_cfp=, calling=, cd=0x555555896bd0) at vm_insnhelper.c:2539 #9 0x00007ffff7e5dd46 in vm_sendish (ec=0x55555555b610, reg_cfp=0x7fffea2f1fa0, cd=0x555555896bd0, block_handler=, method_explorer=) at vm_insnhelper.c:4023 #10 0x00007ffff7e6ddfc in vm_exec_core (ec=0x2, initial=140737488344880) at insns.def:801 #11 0x00007ffff7e7395c in rb_vm_exec (ec=0x55555555b610, mjit_enable_p=1) at vm.c:1929 #12 0x00007ffff7cf80b0 in rb_ec_exec_node (ec=ec@entry=0x55555555b610, n=n@entry=0x5555558f0020) at eval.c:278 #13 0x00007ffff7cfc498 in ruby_run_node (n=0x5555558f0020) at eval.c:336 #14 0x000055555555510b in main (argc=, argv=) at ./main.c:50 (gdb) up #1 0x00007ffff7aa68a4 in __GI_abort () at abort.c:79 79 raise (SIGABRT); (gdb) #2 0x00007ffff7afff27 in __libc_message (action=, fmt=) at ../sysdeps/posix/libc_fatal.c:155 155 abort (); (gdb) #3 0x00007ffff7b07c1c in malloc_printerr (str=str@entry=0x7ffff7c147a8 "free(): double free detected in tcache 2") at malloc.c:5389 5389 __libc_message (do_abort, "%s\n", str); (gdb) #4 0x00007ffff7b096ec in _int_free (av=0x7ffff7c44a00 , p=0x5555557100a0, have_lock=0) at malloc.c:4232 4232 malloc_printerr ("free(): double free detected in tcache 2"); (gdb) #5 0x00007fffe67a3479 in convert (optstr=optstr@entry=0x5555557501d0, cstr=0x5555557100b0) at skf_convert_f_wrap.c:3168 3168 if (cstr != NULL) free(cstr); (gdb) list 3163 }; 3164 3165 if (lwlstr->sstr != NULL) free(lwlstr->sstr); 3166 if (lwlstr != NULL) free(lwlstr); 3167 #if defined(SKF_RUBY19) || defined(SKF_RUBY2) 3168 if (cstr != NULL) free(cstr); 3169 return (ostrdef); 3170 #elif defined(SWIGPYTHON) && defined(SKF_PYTHON3) 3171 ostrdef->sstr = (unsigned char *)skfobuf; 3172 ostrdef->length = ostrdef->length;