summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Calvert <[email protected]>2024-09-06 22:19:47 -0500
committerGitHub <[email protected]>2024-09-07 12:19:47 +0900
commitc1a510a8dffa1c8065e47697cd57edae67126712 (patch)
treeb5119434bd9642690354f87c6d36fa4627642119
parent6dc93846943a0fc85e597fd16c653de6fd7f35d7 (diff)
[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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11563 Merged-By: nobu <[email protected]>
-rw-r--r--gc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 3234784797..c653134695 100644
--- a/gc.c
+++ b/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);
}