mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix potential memory leak at fiber pool
Do not "allocate then wrap". It leaks the allocated memory if failed to create the wrapper.
This commit is contained in:
parent
cdf25cad6b
commit
f69a969544
Notes:
git
2022-03-18 00:42:40 +09:00
1 changed files with 2 additions and 2 deletions
4
cont.c
4
cont.c
|
@ -2845,9 +2845,9 @@ static const rb_data_type_t FiberPoolDataType = {
|
|||
static VALUE
|
||||
fiber_pool_alloc(VALUE klass)
|
||||
{
|
||||
struct fiber_pool * fiber_pool = RB_ALLOC(struct fiber_pool);
|
||||
struct fiber_pool *fiber_pool;
|
||||
|
||||
return TypedData_Wrap_Struct(klass, &FiberPoolDataType, fiber_pool);
|
||||
return TypedData_Make_Struct(klass, struct fiber_pool, &FiberPoolDataType, fiber_pool);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
Loading…
Add table
Reference in a new issue