diff options
author | Seung-Woo Kim <sw0312.kim@samsung.com> | 2023-08-08 11:39:33 +0900 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2023-08-08 11:49:41 +0900 |
commit | 66b231e457676ea47c413e8b08e7ac871053de35 (patch) | |
tree | 04f7277170b4a499f9a4de5bde82dd2748f03f92 | |
parent | 393f0d406105a4abfca9089f736b1523fe7317dd (diff) | |
download | pass-accepted/tizen_unified_riscv.tar.gz pass-accepted/tizen_unified_riscv.tar.bz2 pass-accepted/tizen_unified_riscv.zip |
pass: thermal: Fix possible null deference in thermal_free()accepted/tizen/unified/riscv/20230809.013248accepted/tizen/unified/20230808.170202accepted/tizen_unified_riscv
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 <sw0312.kim@samsung.com>
-rw-r--r-- | src/thermal/thermal.c | 8 |
1 files changed, 5 insertions, 3 deletions
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; + } } /** |