linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "José Antonio Santos Cadenas" <santoscadenas@gmail.com>
To: "Santiago Carot-Nemesio" <sancane@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Avoid possible memory leak in mcap_create_mcl function
Date: Fri, 3 Sep 2010 11:16:05 +0200	[thread overview]
Message-ID: <201009031116.06417.santoscadenas@gmail.com> (raw)
In-Reply-To: <1283502839-5932-1-git-send-email-sancane@gmail.com>

Hi,

El Friday 03 September 2010 10:33:59 Santiago Carot-Nemesio escribió:
> ---
>  health/mcap.c |   21 ++++++++++++++++++++-
>  1 files changed, 20 insertions(+), 1 deletions(-)
> 
> diff --git a/health/mcap.c b/health/mcap.c
> index ec9ea08..dd955e8 100644
> --- a/health/mcap.c
> +++ b/health/mcap.c
> @@ -1755,6 +1755,25 @@ static void connect_dc_event_cb(GIOChannel *chan,
> GError *err, mcl->cb->mdl_connected(mdl, mcl->cb->user_data);
>  }
> 
> +static void mcl_io_destroy(gpointer data)
> +{
> +	struct connect_mcl *con = data;
> +	struct mcap_mcl *mcl = con->mcl;
> +	mcap_mcl_connect_cb connect_cb = con->connect_cb;
> +	gpointer user_data = con->user_data;
> +	GError *err = NULL;
> +
> +	g_free(con);
> +
> +	mcl->ctrl &= ~MCAP_CTRL_CONN;
> +
> +	if (mcl->ctrl & MCAP_CTRL_FREE)
> +		mcl->ms->mcl_uncached_cb(mcl, mcl->ms->user_data);
> +	mcap_mcl_check_del(mcl);
> +	g_set_error(&err, MCAP_ERROR, MCAP_ERROR_FAILED, "Connection error");
> +	connect_cb(NULL, err, user_data);
> +}
> +
>  gboolean mcap_create_mcl(struct mcap_instance *ms,
>  				const bdaddr_t *addr,
>  				uint16_t ccpsm,
> @@ -1790,7 +1809,7 @@ gboolean mcap_create_mcl(struct mcap_instance *ms,
>  	con->user_data = user_data;
> 
>  	mcl->cc = bt_io_connect(BT_IO_L2CAP, mcap_connect_mcl_cb, con,
> -				NULL, err,
> +				mcl_io_destroy, err,
>  				BT_IO_OPT_SOURCE_BDADDR, &ms->src,
>  				BT_IO_OPT_DEST_BDADDR, addr,
>  				BT_IO_OPT_PSM, ccpsm,


We've just found a bug caused by this two patches, please do not apply them 
yet.

Regards.

  reply	other threads:[~2010-09-03  9:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-03  8:31 [PATCH 1/2] Avoid possible memory leak in mcap_connect_mdl function Jose Antonio Santos Cadenas
2010-09-03  8:33 ` [PATCH] Avoid possible memory leak in mcap_create_mcl function Santiago Carot-Nemesio
2010-09-03  9:16   ` José Antonio Santos Cadenas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-09-07 10:36 Santiago Carot-Nemesio

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=201009031116.06417.santoscadenas@gmail.com \
    --to=santoscadenas@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=sancane@gmail.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;
as well as URLs for NNTP newsgroup(s).