Pass NULL as error argument to avoid setting error string in dbus_validate_bus_name(), thus avoid possible memory leak.
We expect the name to be valid bus name (utf8) as it is fetched from the connection.
It will also optimize stack usage as "local_error" variable & dbus_error_init() function are called in for loop.
Other fix could be to check free "error" if it is set.
Signed-off-by: Gaurav Gupta <g.gupta@samsung.com>
Reviewed-by: Himanshu Maithani <himanshu.m@samsung.com>
Change-Id: I773211edd76b6591369bbaae5464971894481a28
{
if (item->type == KDBUS_ITEM_OWNED_NAME)
{
- DBusError local_error;
char *name_ptr = item->name.name;
- dbus_error_init ( &local_error );
- if (!dbus_validate_bus_name (name_ptr, &local_error))
+ if (!dbus_validate_bus_name (name_ptr, NULL))
continue;
if (flags & KDBUS_LIST_QUEUED)