summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNishanth V <nishanth.v@intel.com>2016-05-26 14:39:48 +0530
committerDenis Kenzior <denkenz@gmail.com>2016-05-26 09:27:01 -0500
commitff7837b054aa4a6a5a442b4b49d6294c04abf6f2 (patch)
tree72bfc9e4f50e9f59a71a36c20829574bb20e6f7c
parent1cab1d554d683b119247fede19fb1c4284a3b3c8 (diff)
downloadofono-ff7837b054aa4a6a5a442b4b49d6294c04abf6f2.tar.gz
plugins: Fix allowed apn plugin exit
-rw-r--r--plugins/allowed-apns.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/allowed-apns.c b/plugins/allowed-apns.c
index 77ede862..fd68e35d 100644
--- a/plugins/allowed-apns.c
+++ b/plugins/allowed-apns.c
@@ -32,7 +32,6 @@
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono/plugin.h>
-#include <ofono/log.h>
#include <ofono/modem.h>
#include <ofono/sim.h>
#include <ofono/dbus.h>
@@ -43,6 +42,7 @@
#define ALLOWED_ACCESS_POINTS_INTERFACE "org.ofono.AllowedAccessPoints"
guint modemwatch_id;
+GSList *context_list;
struct allowed_apns_ctx {
guint simwatch_id;
@@ -54,8 +54,6 @@ struct allowed_apns_ctx {
DBusMessage *reply;
};
-GSList *context_list;
-
static void context_destroy(gpointer data)
{
struct allowed_apns_ctx *ctx = data;
@@ -71,8 +69,6 @@ static void context_destroy(gpointer data)
if (ctx->sim_context)
ofono_sim_context_free(ctx->sim_context);
- context_list = g_slist_remove(context_list, ctx);
-
g_free(ctx);
}
@@ -191,8 +187,15 @@ static void sim_watch(struct ofono_atom *atom,
struct allowed_apns_ctx *ctx = data;
if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
- if (ctx->sim_context)
+ if (ctx->simwatch_id) {
+ ofono_sim_remove_state_watch(ctx->sim, ctx->simwatch_id);
+ ctx->simwatch_id = 0;
+ }
+
+ if (ctx->sim_context) {
ofono_sim_context_free(ctx->sim_context);
+ ctx->sim_context = NULL;
+ }
return;
}