From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/4] A2DP: Fix not setting setup error to NULL
Date: Thu, 31 Jan 2013 11:12:42 -0600 [thread overview]
Message-ID: <1359652363-25602-3-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1359652363-25602-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Once the error is informed to the callback it should be properly freed and
set to NULL otherwise a subsequent operation may end up reusing the same
error which might lead to crashes.
---
profiles/audio/a2dp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index efb4178..4b28465 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -366,16 +366,13 @@ static void stream_state_changed(struct avdtp_stream *stream,
static gboolean auto_config(gpointer data)
{
struct a2dp_setup *setup = data;
- struct avdtp_error *err = NULL;
/* Check if configuration was aborted */
if (setup->sep->stream == NULL)
return FALSE;
- if (setup->err != NULL) {
- err = setup->err;
+ if (setup->err != NULL)
goto done;
- }
avdtp_stream_add_cb(setup->session, setup->stream,
stream_state_changed, setup->sep);
@@ -391,8 +388,10 @@ done:
finalize_config(setup);
- if (err)
- g_free(err);
+ if (setup->err) {
+ g_free(setup->err);
+ setup->err = NULL;
+ }
setup_unref(setup);
@@ -565,6 +564,7 @@ static void setconf_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
if (setup) {
setup->err = err;
finalize_config(setup);
+ setup->err = NULL;
}
return;
}
--
1.8.1
next prev parent reply other threads:[~2013-01-31 17:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-31 17:12 [PATCH BlueZ 1/4] AVCTP: Fix allways destroying browsing channel Luiz Augusto von Dentz
2013-01-31 17:12 ` [PATCH BlueZ 2/4] AVCTP: Fix memory leak Luiz Augusto von Dentz
2013-01-31 17:12 ` Luiz Augusto von Dentz [this message]
2013-01-31 17:12 ` [PATCH BlueZ 4/4] AVRCP: Get track duration using GetPlayStatus command Luiz Augusto von Dentz
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=1359652363-25602-3-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@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