make fellow_io_fini() idempotent

during error paths, we might call it multiple times
parent a378525e
......@@ -161,6 +161,9 @@ fellow_io_init(int fd, unsigned entries, void *base, size_t len,
void
fellow_io_fini(fellow_ioctx_t **ctxp)
{
if (*ctxp == NULL)
return;
unsigned entries = fellow_io_entries(*ctxp);
struct fellow_io_aio_ctx *ctx;
......
......@@ -156,6 +156,9 @@ fellow_io_fini(fellow_ioctx_t **ctxp)
{
struct fellow_io_thread *ctx;
if (*ctxp == NULL)
return;
TAKE_OBJ_NOTNULL(ctx, (void **)ctxp, FELLOW_IO_THREAD_MAGIC);
struct fellow_io_status results[ctx->free->nbits];
......
......@@ -320,6 +320,9 @@ fellow_io_fini(fellow_ioctx_t **ctxp)
{
struct fellow_io_uring *ctx;
if (*ctxp == NULL)
return;
TAKE_OBJ_NOTNULL(ctx, (void **)ctxp, FELLOW_IO_URING_MAGIC);
struct fellow_io_status results[ctx->entries];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment