drm/amd: fix potential memory leak
authorBernard Zhao <bernard@vivo.com>
Tue, 23 Aug 2022 06:35:24 +0000 (23:35 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 25 Aug 2022 17:35:18 +0000 (13:35 -0400)
This patch fix potential memory leak (clk_src) when function run
into last return NULL.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c

index 73f2b01..97dc5ee 100644 (file)
@@ -1643,6 +1643,7 @@ static struct clock_source *dcn31_clock_source_create(
        }
 
        BREAK_TO_DEBUGGER();
+       kfree(clk_src);
        return NULL;
 }