mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	bluetooth: Reorganize code to avoid Coverity NULL dereference warning
CID 1353122
this is a false-positive because
   if (dbus_message_has_interface(p->message, "org.bluez.Manager") ||
        dbus_message_has_interface(p->message, "org.bluez.Adapter"))
        d = NULL;
    else if (!(d = pa_hashmap_get(y->devices, dbus_message_get_path(p->message)))) {
        pa_log_warn("Received GetProperties() reply from unknown device: %s (device removed?)",
dbus_message_get_path(p->message));
        goto finish2;
    }
d can be NULL only if p->message interface is org.bluez.Manager or
org.bluez.Adapter. If
    dbus_message_is_method_call(p->message, "org.bluez.Device", "GetProperties")
returns true, we know that the interface is org.bluez.Device.
thanks, Tanu!
			
			
This commit is contained in:
		
							parent
							
								
									41a2849261
								
							
						
					
					
						commit
						aa1882c93f
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -657,13 +657,13 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) {
 | 
			
		|||
 | 
			
		||||
    pa_assert(p->call_data == d);
 | 
			
		||||
 | 
			
		||||
    if (d != NULL)
 | 
			
		||||
    if (d != NULL) {
 | 
			
		||||
        old_any_connected = pa_bluez4_device_any_audio_connected(d);
 | 
			
		||||
        valid = dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR ? -1 : 1;
 | 
			
		||||
 | 
			
		||||
    valid = dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR ? -1 : 1;
 | 
			
		||||
 | 
			
		||||
    if (dbus_message_is_method_call(p->message, "org.bluez.Device", "GetProperties"))
 | 
			
		||||
        d->device_info_valid = valid;
 | 
			
		||||
        if (dbus_message_is_method_call(p->message, "org.bluez.Device", "GetProperties"))
 | 
			
		||||
            d->device_info_valid = valid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (dbus_message_is_error(r, DBUS_ERROR_SERVICE_UNKNOWN)) {
 | 
			
		||||
        pa_log_debug("Bluetooth daemon is apparently not available.");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue