summaryrefslogtreecommitdiffstats
path: root/src/simfs.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2011-05-11 12:29:12 -0500
committerDenis Kenzior <denkenz@gmail.com>2011-05-11 12:29:59 -0500
commit652f2963ae82f6dfd202b514fd364a307a19b82c (patch)
treed7e77cd88c97582b3297765ea60f4ac6b0430a49 /src/simfs.c
parent993acd4132fe01b6c85b36a10f155f067ed39024 (diff)
downloadofono-652f2963ae82f6dfd202b514fd364a307a19b82c.tar.bz2
simfs: Fix error reported by valgrind
==20365== Invalid read of size 8 ==20365== at 0x4B3501: sim_fs_free (simfs.c:114) ==20365== by 0x493CEC: sim_remove (sim.c:2485) ==20365== by 0x4703D7: modem_change_state (modem.c:410) ==20365== by 0x470664: set_powered (modem.c:848) ==20365== by 0x4706BA: __ofono_modem_shutdown (modem.c:2137) ==20365== by 0x46F2C5: signal_cb (main.c:76) ==20365== by 0x52F555E: g_io_unix_dispatch (giounix.c:166) ==20365== by 0x52A0AAB: g_main_dispatch (gmain.c:2440) ==20365== by 0x52A203B: g_main_context_dispatch (gmain.c:3013) ==20365== by 0x52A2501: g_main_context_iterate (gmain.c:3091) ==20365== by 0x52A2C98: g_main_loop_run (gmain.c:3299) ==20365== by 0x46F0D3: main (main.c:243) ==20365== Address 0x63ff998 is 8 bytes inside a block of size 16 free'd ==20365== at 0x4C2612D: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==20365== by 0x52AA4A1: g_free (gmem.c:263) ==20365== by 0x52C433D: g_slice_free1 (gslice.c:907) ==20365== by 0x52C58D0: g_slist_free_1 (gslist.c:192) ==20365== by 0x52C5C5F: g_slist_remove (gslist.c:465) ==20365== by 0x4B342A: sim_fs_context_free (simfs.c:192) ==20365== by 0x4B3500: sim_fs_free (simfs.c:117) ==20365== by 0x493CEC: sim_remove (sim.c:2485) ==20365== by 0x4703D7: modem_change_state (modem.c:410) ==20365== by 0x470664: set_powered (modem.c:848) ==20365== by 0x4706BA: __ofono_modem_shutdown (modem.c:2137) ==20365== by 0x46F2C5: signal_cb (main.c:76)
Diffstat (limited to 'src/simfs.c')
-rw-r--r--src/simfs.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/simfs.c b/src/simfs.c
index 8960bac6..4cfcd30f 100644
--- a/src/simfs.c
+++ b/src/simfs.c
@@ -108,15 +108,8 @@ void sim_fs_free(struct sim_fs *fs)
fs->op_q = NULL;
}
- if (fs->contexts != NULL) {
- GSList *l;
-
- for (l = fs->contexts; l; l = l->next) {
- struct ofono_sim_context *context = l->data;
-
- sim_fs_context_free(context);
- }
- }
+ while (fs->contexts)
+ sim_fs_context_free(fs->contexts->data);
g_free(fs);
}