summaryrefslogtreecommitdiff
path: root/plugins/allowed-apns.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2016-06-06 11:00:25 -0500
committerDenis Kenzior <denkenz@gmail.com>2016-06-06 11:01:17 -0500
commitf420aea45830cb958cefa9cccd75eec94591f76d (patch)
tree225fc80e67c3508822a2678f3cabdbfa6358dbce /plugins/allowed-apns.c
parentff7837b054aa4a6a5a442b4b49d6294c04abf6f2 (diff)
downloadofono-f420aea45830cb958cefa9cccd75eec94591f76d.tar.gz
allowed-apns: Fix crash
When a modem is being removed, all of the modem's atom watches have already been cleaned up. Trying to remove it again results in a crash. Fix by registering a destroy callback which will be notified when the atomwatch has been removed.
Diffstat (limited to 'plugins/allowed-apns.c')
-rw-r--r--plugins/allowed-apns.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/allowed-apns.c b/plugins/allowed-apns.c
index fd68e35d..532d17af 100644
--- a/plugins/allowed-apns.c
+++ b/plugins/allowed-apns.c
@@ -72,6 +72,13 @@ static void context_destroy(gpointer data)
g_free(ctx);
}
+static void atomwatch_destroy(gpointer data)
+{
+ struct allowed_apns_ctx *ctx = data;
+
+ ctx->atomwatch_id = 0;
+}
+
static void sim_acl_read_cb(int ok, int total_length, int record,
const unsigned char *data, int record_length,
void *userdata)
@@ -246,7 +253,8 @@ static void modem_watch(struct ofono_modem *modem,
ctx->atomwatch_id = __ofono_modem_add_atom_watch(ctx->modem,
OFONO_ATOM_TYPE_SIM,
- sim_watch, ctx, NULL);
+ sim_watch, ctx,
+ atomwatch_destroy);
}
static void call_modemwatch(struct ofono_modem *modem, void *userdata)