wispr: Properly handle Agent error
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Fri, 28 Sep 2012 12:41:06 +0000 (15:41 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 1 Oct 2012 10:16:53 +0000 (13:16 +0300)
src/wispr.c

index 879f906..7ee5188 100644 (file)
@@ -567,13 +567,15 @@ static void wispr_portal_request_wispr_login(struct connman_service *service,
 
        DBG("");
 
-       if (error != NULL && g_strcmp0(error,
+       if (error != NULL) {
+               if (g_strcmp0(error,
                        "net.connman.Agent.Error.LaunchBrowser") == 0) {
-
-               if (__connman_agent_request_browser(service,
-                               wispr_portal_browser_reply_cb,
-                               wp_context->redirect_url,
-                               wp_context) != -EINPROGRESS)
+                       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);
 
                return;