This crash happen because the service got disconnected before
the proxy time fire up causing to access deleted data.
I added a check for data, this will be set to NULL on disconnect
which end up calling location_finish. I also make sure location
data structure will be still there on proxy callback.
---
plugins/portal.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/plugins/portal.c b/plugins/portal.c
index 41f18dc..d0d2383 100644
--- a/plugins/portal.c
+++ b/plugins/portal.c
@@ -91,10 +91,14 @@ static void proxy_callback(const char *proxy, void
*user_data)
if (proxy == NULL)
proxy = getenv("http_proxy");
- g_web_set_proxy(data->web, proxy);
+ if (data != NULL) {
+ g_web_set_proxy(data->web, proxy);
- data->request_id = g_web_request_get(data->web, STATUS_URL,
+ data->request_id = g_web_request_get(data->web, STATUS_URL,
web_result, location);
+ }
+
+ connman_location_unref(location);
}
static int location_detect(struct connman_location *location)
@@ -146,8 +150,9 @@ static int location_detect(struct connman_location
*location)
g_web_set_user_agent(data->web, "ConnMan/%s", VERSION);
g_web_set_close_connection(data->web, TRUE);
- connman_proxy_lookup(interface, STATUS_URL,
- proxy_callback, location);
+ if (connman_proxy_lookup(interface, STATUS_URL,
+ proxy_callback, location) > 0)
+ connman_location_ref(location);
return 0;
}
--
1.7.2.3
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman