svace:fix leak 17/124817/2 accepted/tizen/unified/20170413.164657 submit/tizen/20170413.042936
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Wed, 12 Apr 2017 11:24:27 +0000 (20:24 +0900)
committersanghyeok.oh <sanghyeok.oh@samsung.com>
Wed, 12 Apr 2017 11:27:50 +0000 (20:27 +0900)
Change-Id: Ifce97dae8b9390d492708bfd7d7467c1af1ed132
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
dbus/dbus-message.c
dbus/dbus-transport-kdbus.c

index 0e3f323..4a1f794 100644 (file)
@@ -4340,6 +4340,8 @@ load_message (DBusMessageLoader *loader,
     {
       if (_dbus_message_is_gvariant (message))
         {
+          type_str = NULL;
+          type_pos = 0;
           validity = _dbus_validate_gvariant_body_with_reason (type_str,
                                                                type_pos,
                                                                byte_order,
index 6670db8..a3e2dd7 100755 (executable)
@@ -1034,6 +1034,13 @@ kdbus_write_msg_internal (DBusTransportKdbus  *transport,
 
       /* alloc palce for fds */
       fds = dbus_malloc (sizeof (int) * (n_fds + 1));
+      if (fds == NULL)
+        {
+          ret_size = -1;
+          kdbus_close_message (transport, msg_reply);
+          dbus_free (data);
+          goto out;
+        }
 
       /* decode dbus message */
       ret = kdbus_decode_dbus_message (msg_reply, data,
@@ -1042,6 +1049,7 @@ kdbus_write_msg_internal (DBusTransportKdbus  *transport,
         {
           ret_size = -1;
           kdbus_close_message (transport, msg_reply);
+          dbus_free (fds);
           dbus_free (data);
           goto out;
         }
@@ -2162,7 +2170,11 @@ reply_listNames (DBusTransportKdbus *transport,
               if (!dbus_message_iter_append_basic (&array_iter,
                                                    DBUS_TYPE_STRING,
                                                    &name_ptr))
-                goto oom_iterator;
+                {
+                  if (flags & KDBUS_LIST_QUEUED)
+                    free (name_ptr);
+                  goto oom_iterator;
+                }
 
               if (flags & KDBUS_LIST_QUEUED)
                 free (name_ptr);