[PATCH] connection: check service pointer before dereferencing it

Marcel Holtmann marcel at holtmann.org
Wed Jul 8 11:56:50 PDT 2009


Hi Samuel,

> We should check for service not being NULL before dereferencing it.
> 
> ---
>  src/connection.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/src/connection.c b/src/connection.c
> index b20a5a1..61aded6 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -641,7 +641,8 @@ static void update_order(void)
>  
>  		service = __connman_element_get_service(data->element);
>  
> -		data->order = __connman_service_get_order(service);
> +		if (service != NULL)
> +			data->order = __connman_service_get_order(service);
>  	}
>  }

since we do the checks inside the function for all other ones, I added
the NULL pointer check there.

Regards

Marcel




More information about the connman mailing list