summaryrefslogtreecommitdiffstats
path: root/src/ioq.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-03-20 16:41:24 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-03-20 16:41:24 -0400
commit745fd4be765407f7c56d61c281c28e2468ba25b5 (patch)
treee237deacb2e4b66562a83ef5c6d75016cfc37f89 /src/ioq.c
parent912d2b94cf6ff0871c07325af5ed520a2bc97722 (diff)
downloadbfs-745fd4be765407f7c56d61c281c28e2468ba25b5.tar.xz
ioq: Fix some allocation failure paths
Diffstat (limited to 'src/ioq.c')
-rw-r--r--src/ioq.c6
1 files 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]);