From: Youngjae Cho Date: Tue, 11 Feb 2020 08:53:57 +0000 (+0900) Subject: Fix coverity issue X-Git-Tag: accepted/tizen/unified/20200216.215210~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=acfd11ae99ee916a7fc5d95c14014b17f08a1c2e;p=platform%2Fcore%2Fsystem%2Fdeviced.git Fix coverity issue CID 1099199 (#1 of 1): Read from pointer after free (USE_AFTER_FREE) 20. deref_after_free: Dereferencing freed pointer elem. Change-Id: I85c34f351db0cc10ce384176b90ba72067e3c051 Signed-off-by: Youngjae Cho --- diff --git a/src/cpu/pmqos.c b/src/cpu/pmqos.c index ff483d8..c2bbcda 100644 --- a/src/cpu/pmqos.c +++ b/src/cpu/pmqos.c @@ -77,7 +77,7 @@ int set_cpu_pmqos(const char *name, int val) static void pmqos_unlock_timeout_update(void) { - dd_list *elem; + dd_list *elem, *elem_next; struct pmqos_cpu *cpu; int delta = 0; @@ -98,7 +98,7 @@ static void pmqos_unlock_timeout_update(void) /* Delete previous request */ } - DD_LIST_FOREACH(pmqos_head, elem, cpu) { + DD_LIST_FOREACH_SAFE(pmqos_head, elem, elem_next, cpu) { if (cpu->timeout > 0) continue; DD_LIST_REMOVE(pmqos_head, cpu);