diff options
author | Denis Kenzior <denkenz@gmail.com> | 2011-05-11 12:07:41 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-05-11 12:11:23 -0500 |
commit | 623183d99650530eedf45c28033420fed072f087 (patch) | |
tree | 8002e14864e5b0453fdf3c4f5ee438ae029e4880 /src/gprs.c | |
parent | de0b882acffe82953d867b537fe042a1016bc4ff (diff) | |
download | ofono-623183d99650530eedf45c28033420fed072f087.tar.bz2 |
gprs: Fix valgrind error
This fixes an invalid access condition for the case where the
gprs atom is destroyed before context atoms are.
Diffstat (limited to 'src/gprs.c')
-rw-r--r-- | src/gprs.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -2137,17 +2137,18 @@ static void gprs_context_unregister(struct ofono_atom *atom) DBG("%p, %p", gc, gc->gprs); if (gc->gprs == NULL) - return; + goto done; + + gc->gprs->context_drivers = g_slist_remove(gc->gprs->context_drivers, + gc); + gc->gprs = NULL; +done: if (gc->settings) { context_settings_free(gc->settings); g_free(gc->settings); gc->settings = NULL; } - - gc->gprs->context_drivers = g_slist_remove(gc->gprs->context_drivers, - gc); - gc->gprs = NULL; } void ofono_gprs_add_context(struct ofono_gprs *gprs, @@ -2494,6 +2495,7 @@ static void gprs_unregister(struct ofono_atom *atom) static void gprs_remove(struct ofono_atom *atom) { struct ofono_gprs *gprs = __ofono_atom_get_data(atom); + GSList *l; DBG("atom: %p", atom); @@ -2508,6 +2510,12 @@ static void gprs_remove(struct ofono_atom *atom) gprs->pid_map = NULL; } + for (l = gprs->context_drivers; l; l = l->next) { + struct ofono_gprs_context *gc = l->data; + + gc->gprs = NULL; + } + g_slist_free(gprs->context_drivers); if (gprs->driver && gprs->driver->remove) |