Skip to content

Commit

Permalink
drm/amd/display: prevent memory leak
Browse files Browse the repository at this point in the history
In dcn*_create_resource_pool the allocated memory should be released if
construct pool fails.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Navidem authored and alexdeucher committed Sep 25, 2019
1 parent 1e94b43 commit 104c307
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
Expand Up @@ -1091,6 +1091,7 @@ struct resource_pool *dce100_create_resource_pool(
if (construct(num_virtual_links, dc, pool))
return &pool->base;

kfree(pool);
BREAK_TO_DEBUGGER();
return NULL;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
Expand Up @@ -1462,6 +1462,7 @@ struct resource_pool *dce110_create_resource_pool(
if (construct(num_virtual_links, dc, pool, asic_id))
return &pool->base;

kfree(pool);
BREAK_TO_DEBUGGER();
return NULL;
}
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
Expand Up @@ -1342,6 +1342,7 @@ struct resource_pool *dce112_create_resource_pool(
if (construct(num_virtual_links, dc, pool))
return &pool->base;

kfree(pool);
BREAK_TO_DEBUGGER();
return NULL;
}
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
Expand Up @@ -1208,6 +1208,7 @@ struct resource_pool *dce120_create_resource_pool(
if (construct(num_virtual_links, dc, pool))
return &pool->base;

kfree(pool);
BREAK_TO_DEBUGGER();
return NULL;
}
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
Expand Up @@ -1570,6 +1570,7 @@ struct resource_pool *dcn10_create_resource_pool(
if (construct(init_data->num_virtual_links, dc, pool))
return &pool->base;

kfree(pool);
BREAK_TO_DEBUGGER();
return NULL;
}

0 comments on commit 104c307

Please sign in to comment.