Re: [PATCH] android/avrcp: Close AVRCP channel on error

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

 



Hi Andrei,

On Thu, Jan 30, 2014 at 5:23 AM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@xxxxxxxxx> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>
>
> This fixes resource leak.
> ---
>  android/avrcp.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/android/avrcp.c b/android/avrcp.c
> index 485b485..ef833df 100644
> --- a/android/avrcp.c
> +++ b/android/avrcp.c
> @@ -248,13 +248,13 @@ bool bt_avrcp_register(const bdaddr_t *addr)
>         rec = avrcp_record();
>         if (!rec) {
>                 error("Failed to allocate AVRCP record");
> -               return false;
> +               goto fail;
>         }
>
>         if (bt_adapter_add_record(rec, 0) < 0) {
>                 error("Failed to register AVRCP record");
>                 sdp_record_free(rec);
> -               return false;
> +               goto fail;
>         }
>         record_id = rec->handle;
>
> @@ -262,6 +262,12 @@ bool bt_avrcp_register(const bdaddr_t *addr)
>                                                 G_N_ELEMENTS(cmd_handlers));
>
>         return true;
> +fail:
> +       g_io_channel_shutdown(server, TRUE, NULL);
> +       g_io_channel_unref(server);
> +       server = NULL;
> +
> +       return false;
>  }
>
>  void bt_avrcp_unregister(void)
> --
> 1.8.3.2

Applied, thanks.


-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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