mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
gc.c: rename mrb_alloca() to mrb_temp_alloc() and fix memory leaks
rename mrb_alloca() to mrb_temp_alloc() for clearer naming - the new name better describes its purpose as GC-managed temporary allocation. keep mrb_alloca() as a macro alias for backward compatibility. apply mrb_temp_alloc() to fix potential memory leaks in: - mruby-strftime: if mrb_str_cat() raises, allocated buffers now cleaned by GC - mruby-io File.readlink: if mrb_str_new() raises, buffer now cleaned by GC Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -1571,7 +1571,8 @@ MRB_API mrb_value mrb_fiber_alive_p(mrb_state *mrb, mrb_value fib);
|
||||
MRB_API void mrb_stack_extend(mrb_state*, mrb_int);
|
||||
|
||||
/* temporary memory allocation, only effective while GC arena is kept */
|
||||
MRB_API void* mrb_alloca(mrb_state *mrb, size_t);
|
||||
MRB_API void* mrb_temp_alloc(mrb_state *mrb, size_t);
|
||||
#define mrb_alloca(mrb, size) mrb_temp_alloc(mrb, size) /* for compatibility */
|
||||
|
||||
MRB_API void mrb_state_atexit(mrb_state *mrb, mrb_atexit_func func);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user