simfs: Fix issue reported by valgrind

==20287== Invalid read of size 4
==20287==    at 0x52B5C6B: g_queue_peek_nth_link (gqueue.c:704)
==20287==    by 0x52B5F57: g_queue_peek_nth (gqueue.c:848)
==20287==    by 0x4B33ED: sim_fs_context_free (simfs.c:170)
==20287==    by 0x4B34F8: sim_fs_free (simfs.c:116)
==20287==    by 0x493CEC: sim_remove (sim.c:2485)
==20287==    by 0x4703D7: modem_change_state (modem.c:410)
==20287==    by 0x470664: set_powered (modem.c:848)
==20287==    by 0x4706BA: __ofono_modem_shutdown (modem.c:2137)
==20287==    by 0x46F2C5: signal_cb (main.c:76)
==20287==    by 0x52F555E: g_io_unix_dispatch (giounix.c:166)
==20287==    by 0x52A0AAB: g_main_dispatch (gmain.c:2440)
==20287==    by 0x52A203B: g_main_context_dispatch (gmain.c:3013)
==20287==  Address 0x63fae70 is 16 bytes inside a block of size 24
free'd
==20287==    at 0x4C2612D: free (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==20287==    by 0x52AA4A1: g_free (gmem.c:263)
==20287==    by 0x52C433D: g_slice_free1 (gslice.c:907)
==20287==    by 0x52B4E96: g_queue_free (gqueue.c:60)
==20287==    by 0x4B34E0: sim_fs_free (simfs.c:107)
==20287==    by 0x493CEC: sim_remove (sim.c:2485)
==20287==    by 0x4703D7: modem_change_state (modem.c:410)
==20287==    by 0x470664: set_powered (modem.c:848)
==20287==    by 0x4706BA: __ofono_modem_shutdown (modem.c:2137)
==20287==    by 0x46F2C5: signal_cb (main.c:76)
==20287==    by 0x52F555E: g_io_unix_dispatch (giounix.c:166)
==20287==    by 0x52A0AAB: g_main_dispatch (gmain.c:2440)
This commit is contained in:
Denis Kenzior 2011-05-11 12:20:59 -05:00
parent 4714d8199a
commit 993acd4132
1 changed files with 1 additions and 0 deletions

View File

@ -105,6 +105,7 @@ void sim_fs_free(struct sim_fs *fs)
if (fs->op_q) {
g_queue_foreach(fs->op_q, (GFunc) sim_fs_op_free, NULL);
g_queue_free(fs->op_q);
fs->op_q = NULL;
}
if (fs->contexts != NULL) {