diff options
author | Unsung <unsung.lee@samsung.com> | 2024-10-04 15:46:10 +0900 |
---|---|---|
committer | Unsung <unsung.lee@samsung.com> | 2024-10-04 15:46:26 +0900 |
commit | d51e2d71e4c137338d583ff2c0e1efaa21821b79 (patch) | |
tree | ba89d490bdb978d05b66e065f6620899f909d26d | |
parent | a35b4b35f54da9a9b506598794f4257392d175d1 (diff) | |
download | resourced-d51e2d71e4c137338d583ff2c0e1efaa21821b79.tar.gz resourced-d51e2d71e4c137338d583ff2c0e1efaa21821b79.tar.bz2 resourced-d51e2d71e4c137338d583ff2c0e1efaa21821b79.zip |
cpu-boosting: Change g_hash_table_insert to g_hash_table_replaceaccepted/tizen/unified/x/asan/20241013.235729accepted/tizen/unified/x/20241008.034728accepted/tizen/unified/20241007.161025
Change g_hash_table_insert to g_hash_table_replace to avoid
use-after-free issue due to same keys twice.
g_hash_table_insert changes only value if same key already exists.
Therefore, old key can be used after free.
On the other hand, g_hash_table_replace changes value and key to new ones.
Change-Id: I471e0814527961a338503d8573b64bedfc47e6bc
Signed-off-by: Unsung <unsung.lee@samsung.com>
-rw-r--r-- | src/resource-optimizer/cpu/cpu-boosting.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/resource-optimizer/cpu/cpu-boosting.c b/src/resource-optimizer/cpu/cpu-boosting.c index 88f0fed3..35891659 100644 --- a/src/resource-optimizer/cpu/cpu-boosting.c +++ b/src/resource-optimizer/cpu/cpu-boosting.c @@ -1237,7 +1237,7 @@ static void cpu_boosting_register_destination( #endif input->remove_input = false; - g_hash_table_insert(dest_table, (gpointer)input->client_input.dest, input); + g_hash_table_replace(dest_table, (gpointer)input->client_input.dest, input); } static void cpu_boosting_unregister_destination( |