ubusd_monitor: fix possible null pointer dereference
authorPetr Štetiar <ynezz@true.cz>
Thu, 19 Dec 2019 10:10:46 +0000 (11:10 +0100)
committerPetr Štetiar <ynezz@true.cz>
Thu, 19 Dec 2019 18:53:25 +0000 (19:53 +0100)
commitdac6c7c575ac2f8f04706a137e703deffbf88aa7
tree5c707f76e029239aa3e153be5977d8983da364fd
parent060dfbb26da320ed8e897dd522278e7437ee8fe9
ubusd_monitor: fix possible null pointer dereference

This dereference could possibly happen if the calloc call fails as the
return value is unchecked. While at it refactor the code little bit to
make it easier to follow, use safe list iterator and provide return
value for ubusd_monitor_connect.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
ubusd_monitor.c