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:33:56 +0000 (09:33 +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 5260ad6de8038e591bf75e6f2ab1dfd2ad08fb64..24015f8cac75a7dbf5ab7cf8d916f9e9aad915e9 100644 (file)
@@ -878,6 +878,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;
        }