Re: [PATCH BlueZ v1] gatt-server: fix memory leak in bt_gatt_server_send_notification()

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

 



Hi Roman,

On Thu, Jun 27, 2024 at 11:11 AM Roman Smirnov <r.smirnov@xxxxxx> wrote:
>
> data-pdu is allocated but not released when an error occurs.
>
> Add data-pdu release before exiting the function in case of an error.
>
> Found by Linux Verification Center (linuxtesting.org) with the SVACE
> static analysis tool.
> ---
>  src/shared/gatt-server.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
> index 0e399ceb1..fb8819c70 100644
> --- a/src/shared/gatt-server.c
> +++ b/src/shared/gatt-server.c
> @@ -1822,6 +1822,7 @@ bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
>         return result;
>
>  error:
> +       free(data->pdu);
>         if (data)
>                 free(data);

This should probably be inside if (data) block though.

>
> --
> 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