linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@gmail.com>
To: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 15/17] HDP: Fix possible memory leak
Date: Tue, 17 Jun 2014 22:51:39 +0200	[thread overview]
Message-ID: <15088061.dzPvxLDqYO@athlon> (raw)
In-Reply-To: <1402905472-17643-15-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Monday 16 June 2014 10:57:50 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> ---
>  profiles/health/hdp_util.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/profiles/health/hdp_util.c b/profiles/health/hdp_util.c
> index 7185805..876a105 100644
> --- a/profiles/health/hdp_util.c
> +++ b/profiles/health/hdp_util.c
> @@ -597,6 +597,13 @@ fail:
>  	return NULL;
>  }
> 
> +static void free_hdp_list(void *list)
> +{
> +	sdp_list_t *hdp_list = list;
> +
> +	sdp_list_free(hdp_list, (sdp_free_func_t)sdp_data_free);
> +}
> +
>  static gboolean register_features(struct hdp_application *app,
>  						sdp_list_t **sup_features)
>  {
> @@ -619,16 +626,11 @@ static gboolean register_features(struct
> hdp_application *app, fail:
>  	if (hdp_feature != NULL)
>  		sdp_list_free(hdp_feature, (sdp_free_func_t)sdp_data_free);
> +	if (sup_features != NULL)
> +		sdp_list_free(*sup_features, free_hdp_list);

I have a feeling that this should be fixed in caller code ie 
register_service_sup_features.

Also sup_features was already dereferences few lines above so this check is 
not needed (or should it be *sup_features != NULL ?). 

>  	return FALSE;
>  }
> 
> -static void free_hdp_list(void *list)
> -{
> -	sdp_list_t *hdp_list = list;
> -
> -	sdp_list_free(hdp_list, (sdp_free_func_t)sdp_data_free);
> -}
> -
>  static gboolean register_service_sup_features(GSList *app_list,
>  						sdp_record_t *sdp_record)
>  {

-- 
Szymon K. Janc
szymon.janc@gmail.com

  reply	other threads:[~2014-06-17 20:51 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16  7:57 [PATCH 01/17] HDP: Fix checking always constant error code Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 02/17] " Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 03/17] android/HDP: Change scope of mdep Andrei Emeltchenko
2014-06-17 22:15   ` Szymon Janc
2014-06-16  7:57 ` [PATCH 04/17] android/gatt: Change DBG() to error() Andrei Emeltchenko
2014-06-17 21:22   ` Szymon Janc
2014-06-16  7:57 ` [PATCH 05/17] android/gatt: Fix wrong initial value Andrei Emeltchenko
2014-06-17 21:21   ` Szymon Janc
2014-06-18  8:46     ` Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 06/17] HDP: trivial: Make code more readable Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 07/17] android/gatt: Fix meory leak Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 08/17] HDP: Add length check Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 09/17] mcap: Fix possible overflow Andrei Emeltchenko
2014-06-17 21:11   ` Szymon Janc
2014-06-18  8:47     ` Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 10/17] android/hal-sco: Fix error code printing Andrei Emeltchenko
2014-06-17 21:49   ` Szymon Janc
2014-06-16  7:57 ` [PATCH 11/17] android/ipc-tester: Fix closing invalid fd Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 12/17] android/avrcp: Fix adding missing breaks Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 13/17] android/hal-audio: Remove dead code Andrei Emeltchenko
2014-06-17 20:27   ` Szymon Janc
2014-06-16  7:57 ` [PATCH 14/17] android/gatt: Fix error check Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 15/17] HDP: Fix possible memory leak Andrei Emeltchenko
2014-06-17 20:51   ` Szymon Janc [this message]
2014-06-18  8:52     ` Andrei Emeltchenko
2014-06-16  7:57 ` [PATCH 16/17] android/hal-sco: Remove unneeded statement Andrei Emeltchenko
2014-06-17 20:31   ` Szymon Janc
2014-06-16  7:57 ` [PATCH 17/17] android/hal-health: trivial: Remove empty line Andrei Emeltchenko
2014-06-17  7:20 ` [PATCH 01/17] HDP: Fix checking always constant error code Andrei Emeltchenko
2014-06-17 21:27 ` Szymon Janc
2014-06-18  8:54   ` Andrei Emeltchenko
2014-06-18 13:33 ` [PATCHv2 01/11] android/gatt: Change DBG() to error() Andrei Emeltchenko
2014-06-18 13:33   ` [PATCHv2 02/11] android/gatt: Fix wrong initial value Andrei Emeltchenko
2014-06-18 13:33   ` [PATCHv2 03/11] android/gatt: Fix memory leak Andrei Emeltchenko
2014-06-18 13:33   ` [PATCHv2 04/11] android/hal-health: trivial: Correct coding style Andrei Emeltchenko
2014-06-18 13:33   ` [PATCHv2 05/11] android/hal-msg: " Andrei Emeltchenko
2014-06-18 13:33   ` [PATCHv2 06/11] android/gatt: Fix warning by rearranging allocation Andrei Emeltchenko
2014-06-18 13:33   ` [PATCHv2 07/11] android/haltest: Auto-accept pairing Andrei Emeltchenko
2014-06-18 13:33   ` [PATCHv2 08/11] android/health: Remove unneeded check Andrei Emeltchenko
2014-06-18 13:33   ` [PATCHv2 09/11] android/health: Fix possible overflow Andrei Emeltchenko
2014-06-18 13:33   ` [PATCHv2 10/11] android/health: Fix missing error check Andrei Emeltchenko
2014-06-18 13:33   ` [PATCHv2 11/11] android/health: trivial: Remove empty line Andrei Emeltchenko

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=15088061.dzPvxLDqYO@athlon \
    --to=szymon.janc@gmail.com \
    --cc=Andrei.Emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).