From: Marcel Holtmann Date: Fri, 12 Nov 2010 22:24:08 +0000 (+0900) Subject: Don't take reference count based on if result X-Git-Tag: 0.64~59 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53ea3e8733d34ebd3477f36c4b4265934b981e7d;p=platform%2Fupstream%2Fconnman.git Don't take reference count based on if result To make the code more readable turn the failure into a clear error case and only take the reference count later in the code flow. --- diff --git a/plugins/portal.c b/plugins/portal.c index d0d2383..f1d5ce3 100644 --- a/plugins/portal.c +++ b/plugins/portal.c @@ -106,6 +106,7 @@ static int location_detect(struct connman_location *location) struct server_data *data; enum connman_service_type service_type; const char *interface; + int err; DBG("location %p", location); @@ -150,9 +151,12 @@ static int location_detect(struct connman_location *location) g_web_set_user_agent(data->web, "ConnMan/%s", VERSION); g_web_set_close_connection(data->web, TRUE); - if (connman_proxy_lookup(interface, STATUS_URL, - proxy_callback, location) > 0) - connman_location_ref(location); + err = connman_proxy_lookup(interface, STATUS_URL, + proxy_callback, location); + if (err < 0) + return err; + + connman_location_ref(location); return 0; }