Skip to content

Commit 55ddfd5

Browse files
authored
Fixes [Bug #20718] (ruby#11576)
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
1 parent 948ca04 commit 55ddfd5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3491,7 +3491,7 @@ rb_data_free(rb_objspace_t *objspace, VALUE obj)
34913491

34923492
if (dfree) {
34933493
if (dfree == RUBY_DEFAULT_FREE) {
3494-
if (!RTYPEDDATA_EMBEDDED_P(obj)) {
3494+
if (!RTYPEDDATA_P(obj) || !RTYPEDDATA_EMBEDDED_P(obj)) {
34953495
xfree(data);
34963496
RB_DEBUG_COUNTER_INC(obj_data_xfree);
34973497
}

0 commit comments

Comments
 (0)