diff options
author | Rahul Jain <rahul.jain@samsung.com> | 2020-07-21 16:48:45 +0530 |
---|---|---|
committer | Rahul Jain <rahul.jain@samsung.com> | 2020-07-23 14:50:28 +0530 |
commit | 8f4dbb1aa7ce0b39a12b9cc908a8660c5d61f0cc (patch) | |
tree | e25f9acc773fef9e7838041984249361345fca1d | |
parent | f8475e05aab8b64c6779fd4237dceb074b4208d6 (diff) | |
download | connman-8f4dbb1aa7ce0b39a12b9cc908a8660c5d61f0cc.tar.gz connman-8f4dbb1aa7ce0b39a12b9cc908a8660c5d61f0cc.tar.bz2 connman-8f4dbb1aa7ce0b39a12b9cc908a8660c5d61f0cc.zip |
Svace issues: Null check and memory leakssubmit/tizen/20200804.104340submit/tizen/20200730.084504accepted/tizen/unified/20200805.122502
Change-Id: I937af7e6dbe3a919c1d0b0d7dee4b481c2ef0982
-rwxr-xr-x | plugins/wifi.c | 2 | ||||
-rw-r--r-- | src/config.c | 4 | ||||
-rwxr-xr-x | src/dnsproxy.c | 7 | ||||
-rwxr-xr-x | src/network.c | 4 | ||||
-rw-r--r-- | src/session.c | 8 |
5 files changed, 24 insertions, 1 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c index 7f26417b..2f70ee70 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -2986,7 +2986,7 @@ static int mesh_scan(struct connman_device *device) wifi = connman_device_get_data(device); - if (!wifi->mesh_interface) + if (!wifi || !wifi->mesh_interface) return -ENOTSUP; mesh_info = wifi->mesh_info; diff --git a/src/config.c b/src/config.c index 0e550e42..56ca2b8b 100644 --- a/src/config.c +++ b/src/config.c @@ -647,7 +647,11 @@ static bool load_service(GKeyFile *keyfile, const char *group, unsigned int ssid_len; ssid_len = strlen(service->name); +#if defined TIZEN_EXT + ssid = g_try_malloc0(ssid_len + 1); +#else ssid = g_try_malloc0(ssid_len); +#endif if (!ssid) goto err; diff --git a/src/dnsproxy.c b/src/dnsproxy.c index b244a02e..178e98f7 100755 --- a/src/dnsproxy.c +++ b/src/dnsproxy.c @@ -2177,8 +2177,15 @@ static int forward_dns_reply(unsigned char *reply, int reply_len, int protocol, req->resplen = 0; req->resp = g_try_malloc(reply_len); +#if defined TIZEN_EXT + if (!req->resp) { + g_free(new_reply); + return -ENOMEM; + } +#else if (!req->resp) return -ENOMEM; +#endif memcpy(req->resp, reply, reply_len); req->resplen = reply_len; diff --git a/src/network.c b/src/network.c index 243b502d..636da188 100755 --- a/src/network.c +++ b/src/network.c @@ -735,6 +735,10 @@ static int dhcpv6_set_addresses(struct connman_network *network) network->connecting = false; ipconfig_ipv6 = __connman_service_get_ip6config(service); +#if defined TIZEN_EXT + if (!ipconfig_ipv6) + goto err; +#endif err = __connman_ipconfig_address_add(ipconfig_ipv6); if (err < 0) goto err; diff --git a/src/session.c b/src/session.c index 808931a8..6000b6d9 100644 --- a/src/session.c +++ b/src/session.c @@ -1756,8 +1756,16 @@ static bool session_match_service(struct connman_session *session, service_type = connman_service_get_type(service); ifname = connman_service_get_interface(service); + +#if defined TIZEN_EXT + if (bearer_type == current_service_type) { + g_free(ifname); + return false; + } +#else if (bearer_type == current_service_type) return false; +#endif if (bearer_type == service_type && (session->info->config.allowed_interface == NULL || |