Skip to content

Commit ebc77bc

Browse files
zhou1615alexdeucher
authored andcommitted
drm/amd/display/dc/calcs/dce_calcs: Fix a memleak in calculate_bandwidth()
In calculate_bandwidth(), the tag free_sclk and free_yclk are reversed, which could lead to a memory leak of yclk. Fix this bug by changing the location of free_sclk and free_yclk. This bug was found by a static analyzer. Builds with 'make allyesconfig' show no new warnings, and our static analyzer no longer warns about this code. Fixes: 2be8989 ("drm/amd/display/dc/calcs/dce_calcs: Move some large variables from the stack to the heap") Signed-off-by: Zhou Qingyang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 98fdcac commit ebc77bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,10 +2033,10 @@ static void calculate_bandwidth(
20332033
kfree(surface_type);
20342034
free_tiling_mode:
20352035
kfree(tiling_mode);
2036-
free_yclk:
2037-
kfree(yclk);
20382036
free_sclk:
20392037
kfree(sclk);
2038+
free_yclk:
2039+
kfree(yclk);
20402040
}
20412041

20422042
/*******************************************************************************

0 commit comments

Comments
 (0)