summaryrefslogtreecommitdiff
path: root/src/wispr.c
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-08-21 16:45:11 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-08-22 09:01:12 +0300
commit83f6a153b4304ad2fd5dd941e4fd58006b5a1347 (patch)
tree1f5060640e875cbb750e3e0edd5db32e3573385b /src/wispr.c
parent20cb214fb04027290d31716bbeeb00e0a7307f61 (diff)
downloadconnman-83f6a153b4304ad2fd5dd941e4fd58006b5a1347.tar.gz
connman-83f6a153b4304ad2fd5dd941e4fd58006b5a1347.tar.bz2
connman-83f6a153b4304ad2fd5dd941e4fd58006b5a1347.zip
wispr: Fix refcounting issue
Diffstat (limited to 'src/wispr.c')
-rw-r--r--src/wispr.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/wispr.c b/src/wispr.c
index 9571fd84..f08fa7f3 100644
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -638,9 +638,12 @@ static void wispr_portal_request_wispr_login(struct connman_service *service,
"net.connman.Agent.Error.LaunchBrowser") == 0) {
wispr_portal_context_ref(wp_context);
- __connman_agent_request_browser(service,
+ if (__connman_agent_request_browser(service,
wispr_portal_browser_reply_cb,
- wp_context->redirect_url, wp_context);
+ wp_context->redirect_url,
+ wp_context) != -EINPROGRESS)
+ wispr_portal_context_unref(wp_context);
+
return;
}
@@ -650,13 +653,15 @@ static void wispr_portal_request_wispr_login(struct connman_service *service,
g_free(wp_context->wispr_password);
wp_context->wispr_password = g_strdup(password);
+ wispr_portal_context_ref(wp_context);
+
wp_context->request_id = g_web_request_post(wp_context->web,
wp_context->wispr_msg.login_url,
"application/x-www-form-urlencoded",
wispr_input, wispr_portal_web_result,
wp_context);
- if (wp_context->request_id != 0)
- wispr_portal_context_ref(wp_context);
+ if (wp_context->request_id == 0)
+ wispr_portal_context_unref(wp_context);
connman_wispr_message_init(&wp_context->wispr_msg);
}