From ee2611c67894e78f2fb963927bae53a8391dd3df Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sat, 9 Aug 2025 19:48:40 +0100 Subject: [PATCH] core: error: fix double free of errors released with b_error_release --- core/error.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/core/error.c b/core/error.c index f6da334..12d6064 100644 --- a/core/error.c +++ b/core/error.c @@ -459,24 +459,8 @@ enum b_status z__b_error_add_submsg_template( void b_error_release(struct b_error *error) { - struct b_queue_entry *entry = b_queue_pop_back(&error->err_submsg); - while (entry) { - struct b_error_submsg *msg - = b_unbox(struct b_error_submsg, entry, msg_entry); - - if (msg->msg_content) { - free(msg->msg_content); - } - - free(msg); - entry = b_queue_pop_back(&error->err_submsg); - } - - if (error->err_description) { - free(error->err_description); - } - - free(error); + b_queue_delete(&allocated_errors, &error->err_entry); + b_queue_push_back(&free_errors, &error->err_entry); } void z__b_error_throw(