drm: amd: display: Fix memory leakage
authorKonstantin Meskhidze <konstantin.meskhidze@huawei.com>
Wed, 30 Nov 2022 02:50:46 +0000 (10:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:39:52 +0000 (09:39 +0100)
[ Upstream commit 6b8701be1f66064ca72733c5f6e13748cdbf8397 ]

This commit fixes memory leakage in dc_construct_ctx() function.

Signed-off-by: Konstantin Meskhidze <konstantin.meskhidze@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/core/dc.c

index 6c9378208127d7277644e49380bac22f375d935b..eca882438f6ef7ebe902ef66a25197162af6d66a 100644 (file)
@@ -771,6 +771,7 @@ static bool dc_construct_ctx(struct dc *dc,
 
        dc_ctx->perf_trace = dc_perf_trace_create();
        if (!dc_ctx->perf_trace) {
+               kfree(dc_ctx);
                ASSERT_CRITICAL(false);
                return false;
        }