linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anderson Lizardo <anderson.lizardo@openbossa.org>
To: Anderson Lizardo <anderson.lizardo@openbossa.org>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ] attrib: Fix memory leak on watcher exit
Date: Thu, 8 Mar 2012 22:32:07 -0400	[thread overview]
Message-ID: <CAJdJm_MCdLnnmK1y7HrGSfWn2fUwxnMsovtrkCKYnsv-3nmnAw@mail.gmail.com> (raw)
In-Reply-To: <20120308235332.GA19895@x220.amr.corp.intel.com>

Hi Johan,

On Thu, Mar 8, 2012 at 7:53 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Lizardo,
>
> On Thu, Mar 08, 2012, Anderson Lizardo wrote:
>> The "destroy" callback of g_dbus_add_disconnect_watch() is actually
>> never called, therefore the watcher data should be freed on
>> watcher_exit().
>
> Wouldn't it make more sense to fix GDBus so that the destroy callback
> *is* called than to work around it like this?

No other g_dbus_add_disconnect_watch() callers (besides this and LE
thermometer code which is also leaking and for which I have a patch as
well) use destroy callback. To me it seemed it was a known fact that
this parameter is not implemented in gdbus code, so that's why I went
this route.

If you prefer that I implement this destroy functionality, when do you
think it should be called? Only when the watch is removed?

Personally, I think it is better to simply remove this argument from
g_dbus_add_disconnect_watch(), if that is allowed. The caller usually
knows better when to "destroy" its own allocated resources (which may
explain why most users did not try to use this parameter?). What do
you think?

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

  reply	other threads:[~2012-03-09  2:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 20:01 [PATCH BlueZ] attrib: Fix memory leak on watcher exit Anderson Lizardo
2012-03-08 23:53 ` Johan Hedberg
2012-03-09  2:32   ` Anderson Lizardo [this message]
2012-03-14 14:45     ` Anderson Lizardo

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=CAJdJm_MCdLnnmK1y7HrGSfWn2fUwxnMsovtrkCKYnsv-3nmnAw@mail.gmail.com \
    --to=anderson.lizardo@openbossa.org \
    --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).