Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Marcin Kraglak <marcin.kraglak@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] android: Fix NULL pointer dereference
Date: Mon, 31 Mar 2014 15:54:55 +0200	[thread overview]
Message-ID: <6986568.6jbTlktqIB@uw000953> (raw)
In-Reply-To: <1396269913-23447-1-git-send-email-marcin.kraglak@tieto.com>

Hi Marcin,

On Monday 31 of March 2014 14:45:13 Marcin Kraglak wrote:
> If there is no adapter, hal_ipc in not initialized. Below is
> message from valgrind:
> 
> ==22501== Invalid read of size 4
> ==22501==    at 0x805B809: ipc_unregister (ipc.c:421)
> ==22501==    by 0x804AEAF: main (main.c:548)
> ==22501==  Address 0x4 is not stack'd, malloc'd or (recently) free'd
> ---
>  android/main.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/android/main.c b/android/main.c
> index 828f81d..e229a6d 100644
> --- a/android/main.c
> +++ b/android/main.c
> @@ -541,8 +541,11 @@ int main(int argc, char *argv[])
>  	bt_bluetooth_cleanup();
>  	g_main_loop_unref(event_loop);
>  
> -	ipc_unregister(hal_ipc, HAL_SERVICE_ID_CORE);
> -	ipc_cleanup(hal_ipc);
> +	/* If no adapter was initialized, hal_ipc is NULL */
> +	if (hal_ipc) {
> +		ipc_unregister(hal_ipc, HAL_SERVICE_ID_CORE);
> +		ipc_cleanup(hal_ipc);
> +	}
>  
>  	info("Exit");

Applied, thanks.

-- 
Best regards, 
Szymon Janc

      reply	other threads:[~2014-03-31 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-31 12:45 [PATCH] android: Fix NULL pointer dereference Marcin Kraglak
2014-03-31 13:54 ` Szymon Janc [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6986568.6jbTlktqIB@uw000953 \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcin.kraglak@tieto.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox