Re: [PATCH BlueZ] profile: add NULL check to ext_remove_records()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Roman,

On Thu, Jun 27, 2024 at 5:17 AM Roman Smirnov <r.smirnov@xxxxxx> wrote:
>
> Add a NULL check to prevent dereferencing a null pointer in
> case the adapter is NULL
> ---
>  src/profile.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/profile.c b/src/profile.c
> index c62224af9..bb988e8cb 100644
> --- a/src/profile.c
> +++ b/src/profile.c
> @@ -1507,7 +1507,8 @@ static void ext_remove_records(struct ext_profile *ext,
>
>                 ext->records = g_slist_remove(ext->records, r);
>
> -               adapter_service_remove(adapter, r->handle);
> +               if (adapter)
> +                       adapter_service_remove(adapter, r->handle);

I'd move this check inside adapter_service_remove to make it safe to
pass NULL pointers as adapter.

>                 btd_adapter_unref(r->adapter);
>                 g_free(r);
>         }
> --
> 2.43.0
>
>


-- 
Luiz Augusto von Dentz





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux