mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 05:52:48 +07: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:
@@ -364,7 +364,8 @@ int api_init(uev_ctx_t *ctx)
|
||||
if (-1 == listen(sd, 10))
|
||||
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:
|
||||
_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;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,8 @@ static void init_plugins(uev_ctx_t *ctx)
|
||||
PLUGIN_ITERATOR(p, tmp) {
|
||||
if (is_io_plugin(p)) {
|
||||
_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