summaryrefslogtreecommitdiff
path: root/thread_sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread_sync.c')
-rw-r--r--thread_sync.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/thread_sync.c b/thread_sync.c
index e3916c97cb..fa6a60ab62 100644
--- a/thread_sync.c
+++ b/thread_sync.c
@@ -696,13 +696,20 @@ queue_mark_and_move(void *ptr)
}
}
+static inline void
+queue_free_buffer(struct rb_queue *q)
+{
+ if (q->buffer) {
+ SIZED_FREE_N(q->buffer, q->capa);
+ }
+}
+
static void
queue_free(void *ptr)
{
struct rb_queue *q = ptr;
- if (q->buffer) {
- ruby_sized_xfree(q->buffer, q->capa * sizeof(VALUE));
- }
+ queue_free_buffer(q);
+ SIZED_FREE(q);
}
static size_t
@@ -806,7 +813,8 @@ static void
szqueue_free(void *ptr)
{
struct rb_szqueue *sq = ptr;
- queue_free(&sq->q);
+ queue_free_buffer(&sq->q);
+ SIZED_FREE(sq);
}
static size_t