* [Bluez PATCH 4/6] Fix leaks in profiles
@ 2021-05-12 21:37 Steve Grubb
0 siblings, 0 replies; 2+ messages in thread
From: Steve Grubb @ 2021-05-12 21:37 UTC (permalink / raw)
To: linux-bluetooth
g_new0 allocates memory that must be freed
Signed-off-by: Steve Grubb <sgrubb@redhat.com>
---
profiles/audio/avrcp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index c6a342ee3..58d30b24d 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -3508,8 +3508,10 @@ static struct avrcp_player *create_ct_player(struct avrcp *session,
path = device_get_path(session->dev);
mp = media_player_controller_create(path, id);
- if (mp == NULL)
+ if (mp == NULL) {
+ g_free(player);
return NULL;
+ }
media_player_set_callbacks(mp, &ct_cbs, player);
player->user_data = mp;
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Bluez PATCH 4/6] Fix leaks in profiles
@ 2021-05-14 14:00 Steve Grubb
0 siblings, 0 replies; 2+ messages in thread
From: Steve Grubb @ 2021-05-14 14:00 UTC (permalink / raw)
To: linux-bluetooth
g_new0 allocates memory that must be freed
---
profiles/audio/avrcp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index c6a342ee3..58d30b24d 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -3508,8 +3508,10 @@ static struct avrcp_player *create_ct_player(struct avrcp *session,
path = device_get_path(session->dev);
mp = media_player_controller_create(path, id);
- if (mp == NULL)
+ if (mp == NULL) {
+ g_free(player);
return NULL;
+ }
media_player_set_callbacks(mp, &ct_cbs, player);
player->user_data = mp;
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-14 13:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 21:37 [Bluez PATCH 4/6] Fix leaks in profiles Steve Grubb
2021-05-14 14:00 Steve Grubb
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).