Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Santiago Carot <sancane@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Emit missing signal when data channel is reconnected.
Date: Fri, 25 Mar 2011 18:15:32 +0200	[thread overview]
Message-ID: <20110325161532.GA9649@jh-x301> (raw)
In-Reply-To: <AANLkTimEenNDyt3Q6wSoeqiA83hQ4Xth=2dUTf1J9knH@mail.gmail.com>

Hi,

On Fri, Mar 25, 2011, Santiago Carot wrote:
> >> diff --git a/health/hdp.c b/health/hdp.c
> >> index 3c2dce1..b06fe17 100644
> >> --- a/health/hdp.c
> >> +++ b/health/hdp.c
> >> @@ -510,14 +510,23 @@ static void hdp_mdl_reconn_cb(struct mcap_mdl *mdl, GError *err, gpointer data)
> >>       }
> >>
> >>       fd = mcap_mdl_get_fd(dc_data->hdp_chann->mdl);
> >> -     if (fd < 0)
> >> +     if (fd < 0) {
> >>               reply = g_dbus_create_error(dc_data->msg,
> >>                                               ERROR_INTERFACE ".HealthError",
> >>                                               "Cannot get file descriptor");
> >> +             g_dbus_send_message(dc_data->conn, reply);
> >> +             return;
> >> +     }
> >>
> 
> This is not a memory leak fix, if fd is less than 0, then reconnection
> was not succesfully and then we reply with an error response to the
> application but we dont not emit the CahnnelConnected signal. (return
> statement).

The code (before your patch) was assigning a value to reply and then
right afterwards assigning another value to it without freeing it in
between:

> >>       reply = g_dbus_create_reply(dc_data->msg, DBUS_TYPE_UNIX_FD, &fd,
> >>                                                       DBUS_TYPE_INVALID);

How is that not a memory leak? (not to mention that g_dbus_send_message
isn't called to the error message that you create). Looks to me like
there was an "else" statement missing or something similar.

Johan

  reply	other threads:[~2011-03-25 16:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25 13:19 [PATCH] Emit missing signal when data channel is reconnected Santiago Carot-Nemesio
2011-03-25 13:32 ` Johan Hedberg
2011-03-25 13:47   ` Santiago Carot
2011-03-25 16:15     ` Johan Hedberg [this message]
2011-03-25 16:46       ` Santiago Carot

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=20110325161532.GA9649@jh-x301 \
    --to=johan.hedberg@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