mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 10:03:59 +02:00
Fixes [Bug #20718] 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
948ca04a76
commit
55ddfd58dd
1 changed files with 1 additions and 1 deletions
2
gc.c
2
gc.c
|
@ -3491,7 +3491,7 @@ rb_data_free(rb_objspace_t *objspace, VALUE obj)
|
||||||
|
|
||||||
if (dfree) {
|
if (dfree) {
|
||||||
if (dfree == RUBY_DEFAULT_FREE) {
|
if (dfree == RUBY_DEFAULT_FREE) {
|
||||||
if (!RTYPEDDATA_EMBEDDED_P(obj)) {
|
if (!RTYPEDDATA_P(obj) || !RTYPEDDATA_EMBEDDED_P(obj)) {
|
||||||
xfree(data);
|
xfree(data);
|
||||||
RB_DEBUG_COUNTER_INC(obj_data_xfree);
|
RB_DEBUG_COUNTER_INC(obj_data_xfree);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue