From 745fd4be765407f7c56d61c281c28e2468ba25b5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 20 Mar 2024 16:41:24 -0400 Subject: ioq: Fix some allocation failure paths --- src/ioq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ioq.c b/src/ioq.c index 37eed7d..b936681 100644 --- a/src/ioq.c +++ b/src/ioq.c @@ -1064,7 +1064,7 @@ void ioq_free(struct ioq *ioq, struct ioq_ent *ent) { --ioq->size; #if BFS_USE_LIBURING && BFS_USE_STATX - if (ent->op == IOQ_STAT) { + if (ent->op == IOQ_STAT && ent->stat.xbuf) { arena_free(&ioq->xbufs, ent->stat.xbuf); } #endif @@ -1083,7 +1083,9 @@ void ioq_destroy(struct ioq *ioq) { return; } - ioq_cancel(ioq); + if (ioq->nthreads > 0) { + ioq_cancel(ioq); + } for (size_t i = 0; i < ioq->nthreads; ++i) { ioq_thread_join(&ioq->threads[i]); -- cgit v1.2.3