summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-10-23 10:26:44 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-10-23 10:42:57 +0300
commitde9e458c766c0393610db244eda509dc70a35bf4 (patch)
tree5fe76f2c5a53a98860738ab440f6c5f3b54999d5
parent082a40ecad183cb25aefa25fa2e5aa709531b482 (diff)
downloadconnman-de9e458c766c0393610db244eda509dc70a35bf4.tar.gz
connman-de9e458c766c0393610db244eda509dc70a35bf4.tar.bz2
connman-de9e458c766c0393610db244eda509dc70a35bf4.zip
wispr: Free wispr portal context in the relevant place
This fixes 2 issues: - calling __connman_service_ipconfig_indicate_state() might lead to restart wispr_portal check, so context should not be freed afterward but beforehand. - freeing the context in wispr_manage_message() should not happen since wispr_manage_message() will return back to wispr_portal_web_result() where we can still use the context. Thanks to Julien Massot <jmassot@aldebaran-robotics.com> who reported the issue and provided logs.
-rw-r--r--src/wispr.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/wispr.c b/src/wispr.c
index 342f9740..6807297e 100644
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -426,6 +426,8 @@ static void wispr_portal_error(struct connman_wispr_portal_context *wp_context)
static void portal_manage_status(GWebResult *result,
struct connman_wispr_portal_context *wp_context)
{
+ struct connman_service *service = wp_context->service;
+ enum connman_ipconfig_type type = wp_context->type;
const char *str = NULL;
DBG("");
@@ -443,9 +445,10 @@ static void portal_manage_status(GWebResult *result,
&str) == TRUE)
connman_info("Client-Region: %s", str);
- __connman_service_ipconfig_indicate_state(wp_context->service,
- CONNMAN_SERVICE_STATE_ONLINE,
- wp_context->type);
+ free_connman_wispr_portal_context(wp_context);
+
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_ONLINE, type);
}
static gboolean wispr_route_request(const char *address, int ai_family,
@@ -578,11 +581,11 @@ static void wispr_portal_request_wispr_login(struct connman_service *service,
if (__connman_agent_request_browser(service,
wispr_portal_browser_reply_cb,
wp_context->redirect_url,
- wp_context) != -EINPROGRESS)
- free_connman_wispr_portal_context(wp_context);
- } else
- free_connman_wispr_portal_context(wp_context);
+ wp_context) == -EINPROGRESS)
+ return;
+ }
+ free_connman_wispr_portal_context(wp_context);
return;
}
@@ -636,10 +639,8 @@ static gboolean wispr_manage_message(GWebResult *result,
if (__connman_agent_request_login_input(wp_context->service,
wispr_portal_request_wispr_login,
- wp_context) != -EINPROGRESS) {
+ wp_context) != -EINPROGRESS)
wispr_portal_error(wp_context);
- free_connman_wispr_portal_context(wp_context);
- }
break;
case 120: /* Falling down */
@@ -710,7 +711,6 @@ static gboolean wispr_portal_web_result(GWebResult *result, gpointer user_data)
if (g_web_result_get_header(result, "X-ConnMan-Status",
&str) == TRUE) {
portal_manage_status(result, wp_context);
- free_connman_wispr_portal_context(wp_context);
return FALSE;
}
else