[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>
2
gc.c
2
gc.c
@ -1051,7 +1051,7 @@ rb_data_free(void *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…
x
Reference in New Issue
Block a user