diff options
-rw-r--r-- | plugins/pacrunner.c | 1 | ||||
-rw-r--r-- | src/service.c | 27 | ||||
-rw-r--r-- | src/wispr.c | 4 | ||||
-rw-r--r-- | src/wpad.c | 7 |
4 files changed, 34 insertions, 5 deletions
diff --git a/plugins/pacrunner.c b/plugins/pacrunner.c index 84c22ab0..0a9fa553 100644 --- a/plugins/pacrunner.c +++ b/plugins/pacrunner.c @@ -183,6 +183,7 @@ static void create_proxy_configuration(void) connman_dbus_dict_append_array(&dict, "Nameservers", DBUS_TYPE_STRING, append_string_list, str_list); + g_strfreev(str_list); connman_dbus_dict_close(&iter, &dict); diff --git a/src/service.c b/src/service.c index ef25069d..02f494b5 100644 --- a/src/service.c +++ b/src/service.c @@ -2127,9 +2127,30 @@ char **connman_service_get_nameservers(struct connman_service *service) return NULL; if (service->nameservers_config != NULL) - return service->nameservers_config; - else if (service->nameservers != NULL) - return service->nameservers; + return g_strdupv(service->nameservers_config); + else if (service->nameservers != NULL || + service->nameservers_auto != NULL) { + int len = 0, len_auto = 0, i; + char **nameservers; + + if (service->nameservers != NULL) + len = g_strv_length(service->nameservers); + if (service->nameservers_auto != NULL) + len_auto = g_strv_length(service->nameservers_auto); + + nameservers = g_try_new0(char *, len + len_auto + 1); + if (nameservers == NULL) + return NULL; + + for (i = 0; i < len; i++) + nameservers[i] = g_strdup(service->nameservers[i]); + + for (i = 0; i < len_auto; i++) + nameservers[i + len] = + g_strdup(service->nameservers_auto[i]); + + return nameservers; + } return NULL; } diff --git a/src/wispr.c b/src/wispr.c index 31f4caa6..9c45c72e 100644 --- a/src/wispr.c +++ b/src/wispr.c @@ -627,7 +627,7 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context) { enum connman_service_type service_type; char *interface = NULL; - char **nameservers; + char **nameservers = NULL; int if_index; int err = 0; int i; @@ -695,6 +695,8 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context) err = -EINVAL; done: + g_strfreev(nameservers); + g_free(interface); return err; } @@ -147,12 +147,15 @@ int __connman_wpad_start(struct connman_service *service) return -EINVAL; wpad = g_try_new0(struct connman_wpad, 1); - if (wpad == NULL) + if (wpad == NULL) { + g_strfreev(nameservers); return -ENOMEM; + } wpad->service = service; wpad->resolv = g_resolv_new(index); if (wpad->resolv == NULL) { + g_strfreev(nameservers); g_free(wpad); return -ENOMEM; } @@ -163,6 +166,8 @@ int __connman_wpad_start(struct connman_service *service) for (i = 0; nameservers[i] != NULL; i++) g_resolv_add_nameserver(wpad->resolv, nameservers[i], 53, 0); + g_strfreev(nameservers); + wpad->hostname = g_strdup_printf("wpad.%s", domainname); DBG("hostname %s", wpad->hostname); |