From: Jukka Rissanen Date: Fri, 31 Dec 2010 09:57:02 +0000 (+0200) Subject: memoryleak: network interface string was not freed X-Git-Tag: 0.66~67 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a9d2c06de28e98f2b24bd9cfa5c1ef826746725;p=platform%2Fupstream%2Fconnman.git memoryleak: network interface string was not freed --- diff --git a/plugins/portal.c b/plugins/portal.c index 941f03d..043caaf 100644 --- a/plugins/portal.c +++ b/plugins/portal.c @@ -118,7 +118,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); @@ -147,15 +147,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")) @@ -168,11 +171,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)