mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[Bug #20718] Free non-RTypedData
objects
Allow objects that are not of type `RTypedData` to use the default free function, as `RTYPEDDATA_EMBEDDED_P` can return a false positive when casting non-`RTypedData` objects.
This commit is contained in:
parent
6dc9384694
commit
c1a510a8df
Notes:
git
2024-09-07 03:20:07 +00:00
Merged: https://github.com/ruby/ruby/pull/11563 Merged-By: nobu <nobu@ruby-lang.org>
1 changed files with 1 additions and 1 deletions
2
gc.c
2
gc.c
|
@ -1051,7 +1051,7 @@ rb_data_free(void *objspace, VALUE obj)
|
|||
|
||||
if (dfree) {
|
||||
if (dfree == RUBY_DEFAULT_FREE) {
|
||||
if (!RTYPEDDATA_EMBEDDED_P(obj)) {
|
||||
if (!RTYPEDDATA_P(obj) || !RTYPEDDATA_EMBEDDED_P(obj)) {
|
||||
xfree(data);
|
||||
RB_DEBUG_COUNTER_INC(obj_data_xfree);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue