All of lore.kernel.org
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Mariusz Skamra <mariusz.skamra@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/2] android/hog: Fix double queue_destroy
Date: Thu, 12 Mar 2015 15:19:35 +0100	[thread overview]
Message-ID: <8751350.UbEOeYCG5L@leonov> (raw)
In-Reply-To: <1426167455-16583-1-git-send-email-mariusz.skamra@tieto.com>

Hi Mariusz,

On Thursday 12 of March 2015 14:37:34 Mariusz Skamra wrote:
> There is no need to destroy these queues here, there are destroyed in
> hog_free. Prevents from memory violation.
> ---
>  android/hog.c | 16 ++--------------
>  1 file changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/android/hog.c b/android/hog.c
> index 88a5460..9f1fbca 100644
> --- a/android/hog.c
> +++ b/android/hog.c
> @@ -1180,23 +1180,11 @@ struct bt_hog *bt_hog_new(const char *name, uint16_t
> vendor, uint16_t product, return NULL;
> 
>  	hog->gatt_op = queue_new();
> -	if (!hog->gatt_op) {
> -		hog_free(hog);
> -		return NULL;
> -	}
> -
>  	hog->bas = queue_new();
> -	if (!hog->bas) {
> -		queue_destroy(hog->gatt_op, NULL);
> -		hog_free(hog);
> -		return NULL;
> -	}
> -
>  	hog->uhid = bt_uhid_new_default();
> -	if (!hog->uhid) {
> +
> +	if (!(hog->gatt_op && hog->bas && hog->uhid)) {

Please make this if (!hog->gatt_op || !hog->bas || !hog->uhid)

>  		hog_free(hog);
> -		queue_destroy(hog->gatt_op, NULL);
> -		queue_destroy(hog->bas, NULL);
>  		return NULL;
>  	}

-- 
BR
Szymon Janc

  parent reply	other threads:[~2015-03-12 14:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-12 13:37 [PATCH 1/2] android/hog: Fix double queue_destroy Mariusz Skamra
2015-03-12 13:37 ` [PATCH 2/2] unit/test-hog: Add TC/HGRF/RH/BV-01-I test Mariusz Skamra
2015-03-12 14:19 ` Szymon Janc [this message]
2015-03-12 14:48   ` [PATCHv2 1/2] android/hog: Fix double queue_destroy Mariusz Skamra
2015-03-13 15:28     ` Szymon Janc

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=8751350.UbEOeYCG5L@leonov \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mariusz.skamra@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.