diff mbox series

[OpenWrt-Devel,ubus,15/16] ubus_monitor: workaround possibly false positive uses of memory after it is freed

Message ID 20191219221125.22646-16-ynezz@true.cz
State Accepted
Delegated to: Petr Štetiar
Headers show
Series GitLab CI, tests, fuzzing, fixes and improvements | expand

Commit Message

Petr Štetiar Dec. 19, 2019, 10:11 p.m. UTC
scan-build from clang-9 has reported following:

 libubox/list.h:141:2: warning: Use of memory after it is freed
        _list_add(_new, head, head->next);

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 ubusd_monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ubusd_monitor.c b/ubusd_monitor.c
index 501e06d0716c..bba741e86987 100644
--- a/ubusd_monitor.c
+++ b/ubusd_monitor.c
@@ -41,7 +41,7 @@  ubusd_monitor_connect(struct ubus_client *cl, struct ubus_msg_buf *ub)
 		return false;
 
 	m->cl = cl;
-	list_add(&m->list, &monitors);
+	list_add_tail(&m->list, &monitors);
 
 	return true;
 }