Skip to content

Commit eb4a6f0

Browse files
committed
Fix memory leak of TypedData data in Namespace
1 parent d7f412e commit eb4a6f0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

namespace.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ free_loading_table_entry(st_data_t key, st_data_t value, st_data_t arg)
208208
}
209209

210210
static void
211-
namespace_entry_free(void *ptr)
211+
namespace_root_free(void *ptr)
212212
{
213213
rb_namespace_t *ns = (rb_namespace_t *)ptr;
214214
if (ns->loading_table) {
@@ -218,6 +218,13 @@ namespace_entry_free(void *ptr)
218218
}
219219
}
220220

221+
static void
222+
namespace_entry_free(void *ptr)
223+
{
224+
namespace_root_free(ptr);
225+
xfree(ptr);
226+
}
227+
221228
static size_t
222229
namespace_entry_memsize(const void *ptr)
223230
{
@@ -242,7 +249,7 @@ const rb_data_type_t rb_root_namespace_data_type = {
242249
"Namespace::Root",
243250
{
244251
rb_namespace_entry_mark,
245-
namespace_entry_free,
252+
namespace_root_free,
246253
namespace_entry_memsize,
247254
rb_namespace_gc_update_references,
248255
},

0 commit comments

Comments
 (0)