-> gdb ethoam.sim
GNU gdb Red Hat Linux (6.3.0.0-1.143.el4rh)
GDB is free software, covered by the GNU General Public License, and you are
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) set args east
(gdb) b ethoam_pm_delSessionHash
(gdb) run
Breakpoint 1, ethoam_pm_delSessionHash (pm_session=0x817c3b4) at ../src/ethoam_pm_session.C:543
543 ethoam_retCode ret = ETHOAM_OK;
(gdb) n
544 ethoam_pm_session_s* my_pm_session = 0;
(gdb) n
545 ethoam_pm_session_key_s pm_session_key = {0};
(gdb)
547 pm_session_key.md_index = pm_session->pm_index.md_index;
(gdb)
548 pm_session_key.ma_index = pm_session->pm_index.ma_index;
(gdb)
549 pm_session_key.mep_id = pm_session->pm_index.mep_id;
(gdb)
551 ethoam_dumbKeyHashTable_s *hash_table = 0;
(gdb)
553 TRACE_ETHOAM_DETAIL("pm_session=0x%p", pm_session);
(gdb)
ETHOAM DTL - 06:08:27.967: ethoam_pm_delSessionHash: pm_session=0x0x817c3b4
555 ethoam_pm_lock_mutex();
(gdb)
556 if ( pm_session->test_mode == ethoam_pm_test_mode_lm )
(gdb)
558 hash_table = ðoam_lm_session_table;
(gdb)
569 ret = ethoam_dumbKeyHashTableFindObject(hash_table, (void *)&pm_session_key, (void**)&my_pm_session);
(gdb)
570 if (ret != ETHOAM_OK )
(gdb)
577 ethoam_dumbKeyHashTableDeleteElement(hash_table, (void *)&pm_session_key);
(gdb)
579 ethoam_pm_unlock_mutex();
(gdb)
581 return ETHOAM_OK;
(gdb)
584 }
(gdb)
ethoam_pm_delLmSession (pm_session=0x817c3b4) at ../src/ethoam_pm_session.C:305
305 if ( ret != ETHOAM_OK )
(gdb)
312 for (index = 0; index < ethoam_pm_bin_interval_button; index++)
(gdb)
314 ethoam_lm_events_bins_release(&(pm_session->pm_events_bins[index]));
(gdb)
*** glibc detected *** free(): invalid next size (fast): 0x0817cdc8 ***
Program received signal SIGABRT, Aborted.
0x0060e7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) bt
#0 0x0060e7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x006547a5 in raise () from /lib/tls/libc.so.6
#2 0x00656209 in abort () from /lib/tls/libc.so.6
#3 0x00688a1a in __libc_message () from /lib/tls/libc.so.6
#4 0x0068f2bf in _int_free () from /lib/tls/libc.so.6
#5 0x0068f63a in free () from /lib/tls/libc.so.6
#6 0x080e0303 in ethoam_free (ptr=0x817cdcc) at ../src/ethoam_util.C:101
#7 0x080c11da in ethoam_bins_release (pm_bins=0x817c448) at ../src/ethoam_pm_bins.C:398
#8 0x080c1d31 in ethoam_lm_bins_release (pm_bins=0x817c448) at ../src/ethoam_pm_bins.C:530
#9 0x080c35b7 in ethoam_lm_events_bins_release (pm_event_bins=0x817c41c) at ../src/ethoam_pm_events_bins.C:41
#10 0x080c7a21 in ethoam_pm_delLmSession (pm_session=0x817c3b4) at ../src/ethoam_pm_session.C:314
#11 0x080c762a in ethoam_pm_delSession (instance=0, test_name=0xbfffdd00 "my_test") at ../src/ethoam_pm_session.C:221
#12 0x080da662 in ethoam_cmd_pm (argc=3, argv=0xbfffde58) at ../src/ethoam_shell.C:3718
#13 0x080d1597 in ethoam_shell_runcmd (cmd=0xbfffdf40 "ethoam pm session del my_test") at ../src/ethoam_shell.C:453
#14 0x08062c33 in ethoam_shell_command (cmd=0xbfffdf40 "ethoam pm session del my_test", resbuf=0x814ae00 "\ncur time: 06:08:14\n",
ressize=32768) at ../src/ethoam.C:3074
#15 0x080ed8f2 in main (argc=2, argv=0xbfffe0d4) at ethoam_main_sim.C:220
(gdb) frame 7
#7 0x080c11da in ethoam_bins_release (pm_bins=0x817c448) at ../src/ethoam_pm_bins.C:398
398 ethoam_free(pm_bins->actual_bins[index]);
(gdb) info locals
index = 0
(gdb) info stack
#0 0x0060e7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x006547a5 in raise () from /lib/tls/libc.so.6
#2 0x00656209 in abort () from /lib/tls/libc.so.6
#3 0x00688a1a in __libc_message () from /lib/tls/libc.so.6
#4 0x0068f2bf in _int_free () from /lib/tls/libc.so.6
#5 0x0068f63a in free () from /lib/tls/libc.so.6
#6 0x080e0303 in ethoam_free (ptr=0x817cdcc) at ../src/ethoam_util.C:101
#7 0x080c11da in ethoam_bins_release (pm_bins=0x817c448) at ../src/ethoam_pm_bins.C:398
#8 0x080c1d31 in ethoam_lm_bins_release (pm_bins=0x817c448) at ../src/ethoam_pm_bins.C:530
#9 0x080c35b7 in ethoam_lm_events_bins_release (pm_event_bins=0x817c41c) at ../src/ethoam_pm_events_bins.C:41
#10 0x080c7a21 in ethoam_pm_delLmSession (pm_session=0x817c3b4) at ../src/ethoam_pm_session.C:314
#11 0x080c762a in ethoam_pm_delSession (instance=0, test_name=0xbfffdd00 "my_test") at ../src/ethoam_pm_session.C:221
#12 0x080da662 in ethoam_cmd_pm (argc=3, argv=0xbfffde58) at ../src/ethoam_shell.C:3718
#13 0x080d1597 in ethoam_shell_runcmd (cmd=0xbfffdf40 "ethoam pm session del my_test") at ../src/ethoam_shell.C:453
#14 0x08062c33 in ethoam_shell_command (cmd=0xbfffdf40 "ethoam pm session del my_test", resbuf=0x814ae00 "\ncur time: 06:08:14\n",
ressize=32768) at ../src/ethoam.C:3074
free error, check alloc and free, the reason is alloc memory
...malloc(sizeof(bin_size));