summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2021-06-10 18:20:00 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2021-06-10 18:20:00 +0900
commitfd0692ba60b03da85aa02aa5eb642600013f7c7b (patch)
tree6bc357ca186526b21b8d6a764a2c1706ef28a1f4
parent713f1f6ae0d7dd1c702f20e96d43220e2c86c998 (diff)
downloadconnman-fd0692ba60b03da85aa02aa5eb642600013f7c7b.tar.gz
connman-fd0692ba60b03da85aa02aa5eb642600013f7c7b.tar.bz2
connman-fd0692ba60b03da85aa02aa5eb642600013f7c7b.zip
Fix memory leaks and dereference without null checksubmit/tizen/20210615.081101accepted/tizen/unified/20210616.132525
Change-Id: I7accd1386302c26e5bdfa8aee224fe60defc50af Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-xplugins/wifi.c5
-rwxr-xr-xsrc/service.c2
-rwxr-xr-xvpn/plugins/openvpn.c7
-rwxr-xr-xvpn/vpn-provider.c4
4 files changed, 18 insertions, 0 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 6a886d5c..4257a5d4 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2643,6 +2643,9 @@ static int get_latest_connections(int max_ssids,
g_sequence_free(latest_list);
g_key_file_free(keyfile);
g_free(ssid);
+#if defined TIZEN_EXT
+ g_strfreev(services);
+#endif
return -ENOMEM;
}
@@ -5244,6 +5247,8 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
need_save = connman_device_set_last_connected_ident(wifi->device, service_ident);
if (need_save)
connman_device_save_last_connected(wifi->device);
+
+ g_free(service_ident);
}
connman_network_set_last_connected_bssid(connman_network,
diff --git a/src/service.c b/src/service.c
index e4dbc32f..2b69a0bb 100755
--- a/src/service.c
+++ b/src/service.c
@@ -1834,6 +1834,7 @@ static void __connman_manage_saved_profiles()
if (!entry) {
g_sequence_free(profile_list);
g_key_file_free(keyfile);
+ g_strfreev(services);
return;
}
@@ -1857,6 +1858,7 @@ static void __connman_manage_saved_profiles()
}
g_sequence_free(profile_list);
+ g_strfreev(services);
}
#endif
diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c
index 9e8ccebf..ef0bf782 100755
--- a/vpn/plugins/openvpn.c
+++ b/vpn/plugins/openvpn.c
@@ -152,8 +152,15 @@ static struct nameserver_entry *ov_append_dns_entries(const char *key,
options[2]) {
entry = g_try_new(struct nameserver_entry, 1);
+#if defined TIZEN_EXT
+ if (!entry) {
+ g_strfreev(options);
+ return NULL;
+ }
+#else
if (!entry)
return NULL;
+#endif
entry->nameserver = g_strdup(options[2]);
entry->id = atoi(key + 15); /* foreign_option_XXX */
diff --git a/vpn/vpn-provider.c b/vpn/vpn-provider.c
index 0e01ca2a..8d2836ef 100755
--- a/vpn/vpn-provider.c
+++ b/vpn/vpn-provider.c
@@ -2746,6 +2746,10 @@ void vpn_provider_set_data(struct vpn_provider *provider, void *data)
void *vpn_provider_get_plugin_data(struct vpn_provider *provider)
{
+#if defined TIZEN_EXT
+ if (!provider)
+ return NULL;
+#endif
return provider->plugin_data;
}