---
 plugins/portal.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/plugins/portal.c b/plugins/portal.c
index d4456f5..cad2998 100644
--- a/plugins/portal.c
+++ b/plugins/portal.c
@@ -105,7 +105,7 @@ static int location_detect(struct connman_location 
*location)
 {
        struct server_data *data;
        enum connman_service_type service_type;
-       const char *interface;
+       char *interface;
        int err;
 
        DBG("location %p", location);
@@ -134,15 +134,18 @@ static int location_detect(struct connman_location 
*location)
        DBG("interface %s", interface);
 
        data = g_try_new0(struct server_data, 1);
-       if (data == NULL)
-               return -ENOMEM;
+       if (data == NULL) {
+               err = -ENOMEM;
+               goto done;
+       }
 
        connman_location_set_data(location, data);
 
        data->web = g_web_new(0);
        if (data->web == NULL) {
                g_free(data);
-               return -ENOMEM;
+               err = -ENOMEM;
+               goto done;
        }
 
        if (getenv("CONNMAN_WEB_DEBUG"))
@@ -155,11 +158,14 @@ static int location_detect(struct connman_location 
*location)
        err = connman_proxy_lookup(interface, STATUS_URL,
                                        proxy_callback, location);
        if (err < 0)
-               return err;
+               goto done;
 
        connman_location_ref(location);
+       err = 0;
 
-       return 0;
+done:
+       g_free(interface);
+       return err;
 }
 
 static int location_finish(struct connman_location *location)
-- 
1.7.0.4

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to