From 20fdf7869a5d7f2ca50fdfbfdb3f945527673a95 Mon Sep 17 00:00:00 2001 From: Steve Grubb Date: Fri, 14 May 2021 10:00:09 -0400 Subject: [PATCH] profile: Fix memory leaks g_new0 allocates memory that must be freed Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- 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 d854e7f..af8c987 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -3906,8 +3906,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.7.4