summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Calvert <athemeus@athemeus.com>2024-09-10 19:38:48 -0500
committerGitHub <noreply@github.com>2024-09-10 17:38:48 -0700
commit55ddfd58dd6e67e88cf9a3e55bf99550affe8b3f (patch)
tree972439a9c4e3f2c7f57865c3dd28aa990e675e39
parent948ca04a76c0031d17798f79fe3bbc5fb8462e90 (diff)
Fixes [Bug #20718] (#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
-rw-r--r--gc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 378e4a31cb..5ae6dc81bd 100644
--- a/gc.c
+++ b/gc.c
@@ -3491,7 +3491,7 @@ rb_data_free(rb_objspace_t *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);
}