diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-11-13 07:24:08 +0900 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-11-13 07:24:08 +0900 |
commit | 53ea3e8733d34ebd3477f36c4b4265934b981e7d (patch) | |
tree | 9a514ea34aa6589ac4bafa69f17bbe31ed8228f2 /plugins | |
parent | 79559685282bb14a78ae0a3b75af637e519cfee9 (diff) | |
download | connman-53ea3e8733d34ebd3477f36c4b4265934b981e7d.tar.gz connman-53ea3e8733d34ebd3477f36c4b4265934b981e7d.tar.bz2 connman-53ea3e8733d34ebd3477f36c4b4265934b981e7d.zip |
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.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/portal.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/portal.c b/plugins/portal.c index d0d23837..f1d5ce37 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; } |