profile: Fix memory leaks
authorSteve Grubb <sgrubb@redhat.com>
Fri, 14 May 2021 14:00:09 +0000 (10:00 -0400)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:35 +0000 (19:08 +0530)
g_new0 allocates memory that must be freed

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
profiles/audio/avrcp.c

index d854e7f..af8c987 100644 (file)
@@ -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;