workaround possibly false positive uses of memory after it is freed
authorPetr Štetiar <ynezz@true.cz>
Mon, 16 Dec 2019 22:41:31 +0000 (23:41 +0100)
committerPetr Štetiar <ynezz@true.cz>
Thu, 19 Dec 2019 10:18:07 +0000 (11:18 +0100)
commitc5f2053dfcfd1b81a3d29cdd27b26751b96e1acd
tree1b23bb10eb65bb090ca87e260e78353a0e0555b5
parent72be8e93f07d0dfb1f42edfbdb93ea04311dcb5a
workaround possibly false positive uses of memory after it is freed

scan-build from clang-9 has reported following:

 libubox/list.h:83:22: warning: Use of memory after it is freed
        entry->next->prev = entry->prev;
                            ^~~~~~~~~~~

 ubusd_event.c:42:3: warning: Use of memory after it is freed
                ubusd_delete_event_source(ev);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Which might be a false positives, but in order to make the code pass the
static analyzer checks, rewrite the while loops on lists with the safe
list iterator.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
libubus-req.c
libubus.c
ubusd_event.c
ubusd_obj.c
ubusd_proto.c