Svace issues: Null check and memory leaks 70/239070/2 accepted/tizen/unified/20200805.122502 submit/tizen/20200730.084504 submit/tizen/20200804.104340
authorRahul Jain <rahul.jain@samsung.com>
Tue, 21 Jul 2020 11:18:45 +0000 (16:48 +0530)
committerRahul Jain <rahul.jain@samsung.com>
Thu, 23 Jul 2020 09:20:28 +0000 (14:50 +0530)
Change-Id: I937af7e6dbe3a919c1d0b0d7dee4b481c2ef0982

plugins/wifi.c
src/config.c
src/dnsproxy.c
src/network.c
src/session.c

index 7f26417..2f70ee7 100755 (executable)
@@ -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;
index 0e550e4..56ca2b8 100644 (file)
@@ -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;
 
index b244a02..178e98f 100755 (executable)
@@ -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;
index 243b502..636da18 100755 (executable)
@@ -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;
index 808931a..6000b6d 100644 (file)
@@ -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 ||