From 477911553e0443fcafad5bd96c97314aa2f8d9ea Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 14 Jul 2016 10:47:53 +0200 Subject: Integration of scan-build and splint --- src/lib/libkogata/mainloop.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lib/libkogata') diff --git a/src/lib/libkogata/mainloop.c b/src/lib/libkogata/mainloop.c index ece7672..58966dd 100644 --- a/src/lib/libkogata/mainloop.c +++ b/src/lib/libkogata/mainloop.c @@ -65,6 +65,8 @@ void mainloop_run() { for (mainloop_fd_t *fd = mainloop_fds; fd != 0; fd = fd->next) nfds++; + if (nfds == 0) return; + if (sel_arg != 0) free(sel_arg); sel_arg = (sel_fd_t*)malloc(nfds * sizeof(sel_fd_t)); if (sel_arg == 0) { -- cgit v1.2.3