network: Fix nameserver setting routine
authorSamuel Ortiz <sameo@linux.intel.com>
Thu, 24 Feb 2011 22:59:09 +0000 (23:59 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 24 Feb 2011 22:59:09 +0000 (23:59 +0100)
src/network.c
src/provider.c

index 57c8e2f..ae58347 100644 (file)
@@ -1263,11 +1263,13 @@ int connman_network_set_nameservers(struct connman_network *network,
        if (nameservers != NULL)
                nameservers_array = g_strsplit(nameservers, " ", 0);
 
-       for (i = 0; nameservers_array[i] == NULL; i++) {
+       for (i = 0; nameservers_array[i] != NULL; i++) {
                __connman_service_nameserver_append(service,
                                                nameservers_array[i]);
        }
 
+       g_strfreev(nameservers_array);
+
        return 0;
 }
 
index 3aa3537..4061af0 100644 (file)
@@ -861,11 +861,13 @@ int connman_provider_set_nameservers(struct connman_provider *provider,
        if (nameservers != NULL)
                nameservers_array = g_strsplit(nameservers, " ", 0);
 
-       for (i = 0; nameservers_array[i] == NULL; i++) {
+       for (i = 0; nameservers_array[i] != NULL; i++) {
                __connman_service_nameserver_append(provider->vpn_service,
                                                        nameservers_array[i]);
        }
 
+       g_strfreev(nameservers_array);
+
        return 0;
 }