Fix SVACE issues 79/247579/1
authorMukunth A <a.mukunth@samsung.com>
Tue, 3 Nov 2020 06:44:59 +0000 (12:14 +0530)
committerMukunth A <a.mukunth@samsung.com>
Thu, 12 Nov 2020 07:13:52 +0000 (07:13 +0000)
Change-Id: I11a8fb73611c7e521ba6dc52e396f4912adef7a8
Signed-off-by: Mukunth A <a.mukunth@samsung.com>
(cherry picked from commit cab8c54c39288282b98bac3dd7b2305fb9df2ddb)

CMain/lib/liborchestration.a
CMain/src/orchestration_dbus_server.c

index 4c24144dfb8a34d6227e6f5fa2acf8544c1baaa8..c94bbf4176ac4113dd1e0fd11085a80b9b498dd7 100644 (file)
Binary files a/CMain/lib/liborchestration.a and b/CMain/lib/liborchestration.a differ
index d733400149b328c09b4c4c7df338cf3ffc3a7a09..b5b06d3ecb486fdb0c9f50c728da017625c5d891 100644 (file)
@@ -276,11 +276,15 @@ static void _handle_method_call(
                     token = strtok(ipaddr_list, ",");
                     while (token != NULL)
                     {
-                        ipaddr[num_ip] = (char*) malloc(sizeof(char) * (strlen(token) + 1));
-                        strncpy(ipaddr[num_ip], token, strlen(token));
-                        ipaddr[num_ip][strlen(token)] = '\0';
+                        char *addr = (char*) malloc(sizeof(char) * (strlen(token) + 1));
+                        if (addr)
+                        {
+                            strncpy(addr, token, strlen(token));
+                            addr[strlen(token)] = '\0';
+                            ipaddr[num_ip] = addr;
+                            num_ip++;
+                        }
                         token = strtok(NULL, ",");
-                        num_ip++;
                     }
                 }
                 free(ipaddr_listcopy);
@@ -312,14 +316,6 @@ static void _handle_method_call(
             char *capability = NULL, *message = NULL;
             ret = _read_device_capability(parameters, origin_client_pid, &capability, &message);
 
-               if (capability) {
-                       printf("capability :: %s\n", capability);
-               }
-
-               if (message) {
-                       printf("message :: %s\n", message);
-               }
-
             GVariant *value;
             value = g_variant_new("((ss))", strdup(capability), strdup(message));
 
@@ -335,6 +331,11 @@ static void _handle_method_call(
             char *write_ret = NULL;
             ret = _write_device_capability(parameters, origin_client_pid, &write_ret);
             _gdbus.invocation_return_value(invocation, g_variant_new("(i)", ret));
+            if (write_ret)
+            {
+                free (write_ret);
+                write_ret = NULL;
+            }
         }
 
         if (ret == ORCH_ERROR_NONE)