summaryrefslogtreecommitdiff
path: root/plugins/portal.c
diff options
context:
space:
mode:
authorMohamed Abbas <mabbas@linux.intel.com>2010-11-11 13:12:19 -0800
committerSamuel Ortiz <sameo@linux.intel.com>2010-11-12 12:00:37 +0100
commit7f6ba9d3e33b19460cb9e11c5c866172e9a2ce1e (patch)
tree78c4d6a7e259f346d0683003fe865b6a90211ad7 /plugins/portal.c
parent110cff03f46af0306e45d5a0b835cc41cee50d5d (diff)
downloadconnman-7f6ba9d3e33b19460cb9e11c5c866172e9a2ce1e.tar.gz
connman-7f6ba9d3e33b19460cb9e11c5c866172e9a2ce1e.tar.bz2
connman-7f6ba9d3e33b19460cb9e11c5c866172e9a2ce1e.zip
Fix for crash with new proxy lookup callbacks
This crash happens when the service disconnects before the proxy callback is called.
Diffstat (limited to 'plugins/portal.c')
-rw-r--r--plugins/portal.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/portal.c b/plugins/portal.c
index 41f18dcd..d0d23837 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;
}