Skip to content

Commit

Permalink
drm/amd/powerplay: fix memory leak of tdp_table
Browse files Browse the repository at this point in the history
tdp_table is being leaked on failed allocations of
hwmgr->dyn_state.cac_dtp_table. kfree tdp_table on the error
return path to fix the leak.

Signed-off-by: Colin Ian King <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
  • Loading branch information
Colin Ian King authored and alexdeucher committed Mar 21, 2016
1 parent 568d7c7 commit a82d397
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,10 @@ static int get_cac_tdp_table(

hwmgr->dyn_state.cac_dtp_table = kzalloc(table_size, GFP_KERNEL);

if (NULL == hwmgr->dyn_state.cac_dtp_table)
if (NULL == hwmgr->dyn_state.cac_dtp_table) {
kfree(tdp_table);
return -ENOMEM;
}

memset(hwmgr->dyn_state.cac_dtp_table, 0x00, table_size);

Expand Down

0 comments on commit a82d397

Please sign in to comment.