Fixed potential memory leak
Create a wrapper object first, then buffer allocation which can fail.
This commit is contained in:
parent
38a4f617de
commit
79d9528ddc
@ -9721,12 +9721,13 @@ static VALUE
|
|||||||
pinned_list_new(long size)
|
pinned_list_new(long size)
|
||||||
{
|
{
|
||||||
struct pinned_list * ptr;
|
struct pinned_list * ptr;
|
||||||
|
VALUE obj_list =
|
||||||
|
TypedData_Make_Struct(0, struct pinned_list, &pinned_list_type, ptr);
|
||||||
|
|
||||||
ptr = xmalloc(sizeof(struct pinned_list));
|
|
||||||
ptr->size = size;
|
|
||||||
ptr->buffer = xcalloc(size, sizeof(VALUE));
|
ptr->buffer = xcalloc(size, sizeof(VALUE));
|
||||||
|
ptr->size = size;
|
||||||
|
|
||||||
return TypedData_Wrap_Struct(0, &pinned_list_type, ptr);
|
return obj_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ibf_offset_t
|
static ibf_offset_t
|
||||||
|
@ -189,6 +189,7 @@ class Gem::Installer
|
|||||||
if options[:user_install]
|
if options[:user_install]
|
||||||
@gem_home = Gem.user_dir
|
@gem_home = Gem.user_dir
|
||||||
@bin_dir = Gem.bindir gem_home unless options[:bin_dir]
|
@bin_dir = Gem.bindir gem_home unless options[:bin_dir]
|
||||||
|
@plugins_dir = Gem.plugindir(gem_home)
|
||||||
check_that_user_bin_dir_is_in_path
|
check_that_user_bin_dir_is_in_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user