Commit 018ea797 authored by Mirsal Ennaime's avatar Mirsal Ennaime

dbus: Add missing memory allocation failure handling

Handle memory allocation failures when sending the PropertyChanged
signal in the TrackList interface implementation.
parent 57a0261e
......@@ -496,17 +496,29 @@ PropertiesChangedSignal( intf_thread_t *p_intf,
OUT_ARGUMENTS;
ADD_STRING( &psz_interface_name );
dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "{sv}",
&changed_properties );
dbus_message_iter_close_container( &args, &changed_properties );
if( unlikely(!dbus_message_iter_open_container( &args,
DBUS_TYPE_ARRAY, "{sv}",
&changed_properties )) )
return DBUS_HANDLER_RESULT_NEED_MEMORY;
dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "s",
&invalidated_properties );
if( unlikely(!dbus_message_iter_close_container( &args,
&changed_properties )) )
return DBUS_HANDLER_RESULT_NEED_MEMORY;
if( unlikely(!dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "s",
&invalidated_properties )) )
return DBUS_HANDLER_RESULT_NEED_MEMORY;
i_properties = vlc_dictionary_keys_count( p_changed_properties );
ppsz_properties = vlc_dictionary_all_keys( p_changed_properties );
if( unlikely(!ppsz_properties) )
{
dbus_message_iter_abandon_container( &args, &invalidated_properties );
return DBUS_HANDLER_RESULT_NEED_MEMORY;
}
for( int i = 0; i < i_properties; i++ )
{
if( !strcmp( ppsz_properties[i], "Tracks" ) )
......@@ -517,9 +529,12 @@ PropertiesChangedSignal( intf_thread_t *p_intf,
free( ppsz_properties[i] );
}
dbus_message_iter_close_container( &args, &invalidated_properties );
free( ppsz_properties );
if( unlikely(!dbus_message_iter_close_container( &args,
&invalidated_properties )) )
return DBUS_HANDLER_RESULT_NEED_MEMORY;
SIGNAL_SEND;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment