From: sanghyeok.oh Date: Wed, 12 Apr 2017 11:24:27 +0000 (+0900) Subject: svace:fix leak X-Git-Tag: accepted/tizen/unified/20170413.164657^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73d29ba2d5bdd7d89c414cd967cd510d48c58bfa;p=platform%2Fupstream%2Fdbus.git svace:fix leak Change-Id: Ifce97dae8b9390d492708bfd7d7467c1af1ed132 Signed-off-by: sanghyeok.oh --- diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 0e3f323..4a1f794 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -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, diff --git a/dbus/dbus-transport-kdbus.c b/dbus/dbus-transport-kdbus.c index 6670db8..a3e2dd7 100755 --- a/dbus/dbus-transport-kdbus.c +++ b/dbus/dbus-transport-kdbus.c @@ -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);