diff options
author | Daniel Wagner <wagi@monom.org> | 2022-01-25 10:00:22 +0100 |
---|---|---|
committer | Daniel Wagner <wagi@monom.org> | 2022-01-25 10:09:43 +0100 |
commit | 8bed0e22cb59468e773b247724a114d6764bd0a6 (patch) | |
tree | 081eb7c80ceb1b4224e6c70d2fc3565366468f31 | |
parent | ed3e8b59e90f5a388fcb339d46e2e5dc7e29d099 (diff) | |
download | connman-8bed0e22cb59468e773b247724a114d6764bd0a6.tar.gz |
main: Use g_strdup for online_check_ipv{4,6}_url config
We are using g_free() on ConnMan's exist path, hence we would try to
free non malloc memory.
-rw-r--r-- | src/main.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -127,8 +127,8 @@ static struct { .vendor_class_id = NULL, .enable_online_check = true, .enable_online_to_ready_transition = false, - .online_check_ipv4_url = DEFAULT_ONLINE_CHECK_IPV4_URL, - .online_check_ipv6_url = DEFAULT_ONLINE_CHECK_IPV6_URL, + .online_check_ipv4_url = NULL, + .online_check_ipv6_url = NULL, .online_check_initial_interval = DEFAULT_ONLINE_CHECK_INITIAL_INTERVAL, .online_check_max_interval = DEFAULT_ONLINE_CHECK_MAX_INTERVAL, .auto_connect_roaming_services = false, @@ -503,6 +503,9 @@ static void parse_config(GKeyFile *config) CONF_ONLINE_CHECK_IPV4_URL, &error); if (!error) connman_settings.online_check_ipv4_url = string; + else + connman_settings.online_check_ipv4_url = + g_strdup(DEFAULT_ONLINE_CHECK_IPV4_URL); g_clear_error(&error); @@ -510,6 +513,10 @@ static void parse_config(GKeyFile *config) CONF_ONLINE_CHECK_IPV6_URL, &error); if (!error) connman_settings.online_check_ipv6_url = string; + else + connman_settings.online_check_ipv6_url = + g_strdup(DEFAULT_ONLINE_CHECK_IPV6_URL); + g_clear_error(&error); |