[PATCH] dbus: Close dbus dict just after appending data

Dan Williams dcbw at redhat.com
Mon Aug 4 14:23:38 EDT 2014


On Sun, 2014-08-03 at 18:48 -0400, Eduardo Abinader wrote:
> Before fixing this issue, calling wpas_dbus_getter_p2p_device_config
> was causing early termination of dbus connection, due to writing
> values to an already closed dict.
> 
> Signed-off-by: Eduardo Abinader <eduardo.abinader at openbossa.org>
> ---
>  wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Good catch; patch looks good.

Dan

> diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
> index 516551a..c9ecc7b 100644
> --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
> +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
> @@ -830,15 +830,15 @@ dbus_bool_t wpas_dbus_getter_p2p_device_config(DBusMessageIter *iter,
>  				       wpa_s->conf->p2p_no_group_iface))
>  		goto err_no_mem;
>  
> -	if (!wpa_dbus_dict_close_write(&variant_iter, &dict_iter) ||
> -	    !dbus_message_iter_close_container(iter, &variant_iter))
> -		goto err_no_mem;
> -
>  	/* P2P Search Delay */
>  	if (!wpa_dbus_dict_append_uint32(&dict_iter, "p2p_search_delay",
>  					 wpa_s->conf->p2p_search_delay))
>  		goto err_no_mem;
>  
> +	if (!wpa_dbus_dict_close_write(&variant_iter, &dict_iter) ||
> +	    !dbus_message_iter_close_container(iter, &variant_iter))
> +		goto err_no_mem;
> +
>  	return TRUE;
>  
>  err_no_mem:




More information about the HostAP mailing list