From: Seung-Woo Kim Date: Tue, 8 Aug 2023 02:39:33 +0000 (+0900) Subject: pass: thermal: Fix possible null deference in thermal_free() X-Git-Tag: accepted/tizen/unified/20230808.170202^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F55%2F296955%2F2;p=platform%2Fcore%2Fsystem%2Fpass.git pass: thermal: Fix possible null deference in thermal_free() When there is no thermal scenario, thermal can not be initialized and g_thermal is null. Exiting pass from the status, in thermal_free(), there is null deference. Fix the possible null deference. Change-Id: I69ab200ea3d182adc628913d89306db6fe3ebcff Signed-off-by: Seung-Woo Kim --- diff --git a/src/thermal/thermal.c b/src/thermal/thermal.c index 40773c2..7ad7c0a 100644 --- a/src/thermal/thermal.c +++ b/src/thermal/thermal.c @@ -91,10 +91,12 @@ static void thermal_free(void) if (ret < 0) _E("failed to put Thermal Monitor scenario\n"); - g_ptr_array_free(g_thermal->resources, TRUE); + if (g_thermal) { + g_ptr_array_free(g_thermal->resources, TRUE); - free(g_thermal); - g_thermal = NULL; + free(g_thermal); + g_thermal = NULL; + } } /**