summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-13 13:06:58 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-13 13:06:58 +0000
commit2270365bde104a118b60541fd5d99a040b3d7da2 (patch)
tree0dcb35b79ad952dca0ccf9cfd34877b83e72ba0a
parent6b6680945ed3274cddbc34fdfd410d74081a3e94 (diff)
* string.c (str_discard): does not free for STR_NOFREE string.
[Bug #10853][ruby-core:68110] * bootstraptest/test_string.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--bootstraptest/test_string.rb3
-rw-r--r--string.c2
3 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d14807b4744..f0bbe1eed9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Feb 13 21:52:05 2015 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * string.c (str_discard): does not free for STR_NOFREE string.
+ [Bug #10853][ruby-core:68110]
+
+ * bootstraptest/test_string.rb: test for above.
+
Fri Feb 13 21:16:00 2015 Yusuke Endoh <mame@tsg.ne.jp>
* lib/base64.rb: make urlsafe mode user-friendly.
diff --git a/bootstraptest/test_string.rb b/bootstraptest/test_string.rb
new file mode 100644
index 00000000000..849dcd45b00
--- /dev/null
+++ b/bootstraptest/test_string.rb
@@ -0,0 +1,3 @@
+assert_normal_exit %q{
+ inspect.clear
+}, '[ruby-core:68110]'
diff --git a/string.c b/string.c
index 5de795a29a3..d8102131605 100644
--- a/string.c
+++ b/string.c
@@ -1662,7 +1662,7 @@ static inline void
str_discard(VALUE str)
{
str_modifiable(str);
- if (!STR_SHARED_P(str) && !STR_EMBED_P(str)) {
+ if (!STR_EMBED_P(str) && !FL_TEST(str, STR_SHARED|STR_NOFREE)) {
ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
RSTRING(str)->as.heap.ptr = 0;
RSTRING(str)->as.heap.len = 0;