mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00:00
Check return value from uev_io_init() at runtime
Possible resource leak due to unchecked return value from uev_io_init() found by Coverity Scan. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
e53acd1cdd
commit
662f364d09
3 files changed
+11
-3
No files matched your search
@@ -364,7 +364,8 @@ int api_init(uev_ctx_t *ctx)
|
|||||||
if (-1 == listen(sd, 10))
|
if (-1 == listen(sd, 10))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return uev_io_init(ctx, &api_watcher, cb, NULL, sd, UEV_READ);
|
if (!uev_io_init(ctx, &api_watcher, cb, NULL, sd, UEV_READ))
|
||||||
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
_pe("Failed intializing API socket");
|
_pe("Failed intializing API socket");
|
||||||
|
|||||||
@@ -239,7 +239,13 @@ static int spawn_socket(inetd_t *inetd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uev_io_init(ctx, &inetd->watcher, socket_cb, inetd->svc, sd, UEV_READ);
|
if (uev_io_init(ctx, &inetd->watcher, socket_cb, inetd->svc, sd, UEV_READ)) {
|
||||||
|
FLOG_PERROR("Failed setting up inetd watcher for %s", inetd->name);
|
||||||
|
close(sd);
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -211,7 +211,8 @@ static void init_plugins(uev_ctx_t *ctx)
|
|||||||
PLUGIN_ITERATOR(p, tmp) {
|
PLUGIN_ITERATOR(p, tmp) {
|
||||||
if (is_io_plugin(p)) {
|
if (is_io_plugin(p)) {
|
||||||
_d("Initializing plugin %s for I/O", basename(p->name));
|
_d("Initializing plugin %s for I/O", basename(p->name));
|
||||||
uev_io_init(ctx, &p->watcher, generic_io_cb, p, p->io.fd, p->io.flags);
|
if (uev_io_init(ctx, &p->watcher, generic_io_cb, p, p->io.fd, p->io.flags))
|
||||||
|
_e("Failed setting up I/O plugin %s", basename(p->name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user