From: Marcel Holtmann Date: Fri, 25 Dec 2009 10:47:12 +0000 (-0800) Subject: Some cleanup with the provision handling X-Git-Tag: accepted/2.0alpha-wayland/20121110.002834~2966 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2bd9b034afbe49d154151c99e822de2bea382116;p=profile%2Fivi%2Fconnman.git Some cleanup with the provision handling --- diff --git a/src/config.c b/src/config.c index cd63d40..af97831 100644 --- a/src/config.c +++ b/src/config.c @@ -203,10 +203,10 @@ done: static void free_config(struct connman_config *config) { + free_service(config->service); g_free(config->description); g_free(config->name); g_free(config->ident); - free_service(config->service); g_free(config); } @@ -386,7 +386,6 @@ int __connman_config_provision_service(struct connman_service *service) GHashTableIter iter; gpointer value, key; struct connman_network *network; - struct connman_config *config = NULL; const void *ssid; unsigned int ssid_len; @@ -407,18 +406,23 @@ int __connman_config_provision_service(struct connman_service *service) g_hash_table_iter_init(&iter, config_hash); while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) { - config = value; + struct connman_config *config = value; + + if (config->service == NULL) + continue; /* For now only WiFi service entries are supported */ - if (config->service && - g_strcmp0(config->service->type, "wifi") == 0 && - ssid_len == config->service->ssid_len) - if (config->service->ssid && - memcmp(config->service->ssid, ssid, - ssid_len) == 0) { - config_service_setup(service, config->service); - break; - } + if (g_strcmp0(config->service->type, "wifi") != 0) + continue; + + if (config->service->ssid == NULL || + ssid_len != config->service->ssid_len) + continue; + + if (memcmp(config->service->ssid, ssid, ssid_len) == 0) { + config_service_setup(service, config->service); + break; + } } return 0;