From: Harry Wentland Date: Tue, 18 Apr 2017 15:43:22 -0400 Subject: drm/amd/display: Fix memory leak in post_update_surfaces Git-commit: 50f27269b8dd81d73c787dd18ba19a08bec128d3 Patch-mainline: v4.15-rc1 References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166 Signed-off-by: Harry Wentland Acked-by: Harry Wentland Reviewed-by: Tony Cheng Signed-off-by: Alex Deucher Acked-by: Petr Tesarik --- drivers/gpu/drm/amd/display/dc/core/dc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -918,6 +918,7 @@ bool dc_post_update_surfaces_to_stream(s int i; struct core_dc *core_dc = DC_TO_CORE(dc); struct validate_context *context = dm_alloc(sizeof(struct validate_context)); + bool result = true; if (!context) { dm_error("%s: failed to create validate ctx\n", __func__); @@ -935,17 +936,19 @@ bool dc_post_update_surfaces_to_stream(s if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) { BREAK_TO_DEBUGGER(); - return false; + result = false; + goto cleanup; } core_dc->hwss.set_bandwidth(core_dc, context, true); dc_resource_validate_ctx_copy_construct(context, core_dc->current_context); +cleanup: dc_resource_validate_ctx_destruct(context); dm_free(context); - return true; + return result; } bool dc_commit_surfaces_to_stream(