[前][次][番号順一覧][スレッド一覧]

ruby-changes:60585

From: usa <ko1@a...>
Date: Tue, 31 Mar 2020 06:12:03 +0900 (JST)
Subject: [ruby-changes:60585] 07ae2fe9d0 (ruby_2_5): merge revision(s) 78ef2d0f331c3e056ee367214710b41722de2fe0: [Backport #15935]

https://git.ruby-lang.org/ruby.git/commit/?id=07ae2fe9d0

From 07ae2fe9d0b6b7920fe75b8e856b87d50777b7a4 Mon Sep 17 00:00:00 2001
From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Mon, 30 Mar 2020 21:11:41 +0000
Subject: merge revision(s) 78ef2d0f331c3e056ee367214710b41722de2fe0: [Backport
 #15935]

	merge revision(s) 8b3774be3dd9f472bddd99e84e3c9fe2ff99d7ac: [Backport
	 #15935]

		Fix memory leak

		* string.c (str_make_independent_expand): free independent buffer.
		  [Bug# 15935]

		Co-Authored-By: luke-gru (Luke Gruber) <luke.gru@g...>

	git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

diff --git a/string.c b/string.c
index ed7da23..f0d1a28 100644
--- a/string.c
+++ b/string.c
@@ -2043,7 +2043,7 @@ static void https://github.com/ruby/ruby/blob/trunk/string.c#L2043
 str_make_independent_expand(VALUE str, long len, long expand, const int termlen)
 {
     char *ptr;
-    const char *oldptr;
+    char *oldptr;
     long capa = len + expand;
 
     if (len > capa) len = capa;
@@ -2062,6 +2062,9 @@ str_make_independent_expand(VALUE str, long len, long expand, const int termlen) https://github.com/ruby/ruby/blob/trunk/string.c#L2062
     if (oldptr) {
 	memcpy(ptr, oldptr, len);
     }
+    if (FL_TEST_RAW(str, STR_NOEMBED|STR_NOFREE|STR_SHARED) == STR_NOEMBED) {
+        xfree(oldptr);
+    }
     STR_SET_NOEMBED(str);
     FL_UNSET(str, STR_SHARED|STR_NOFREE);
     TERM_FILL(ptr + len, termlen);
diff --git a/version.h b/version.h
index 0e6be70..5d42d30 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1
 #define RUBY_VERSION "2.5.8"
-#define RUBY_RELEASE_DATE "2019-12-04"
-#define RUBY_PATCHLEVEL 209
+#define RUBY_RELEASE_DATE "2020-03-31"
+#define RUBY_PATCHLEVEL 210
 
-#define RUBY_RELEASE_YEAR 2019
-#define RUBY_RELEASE_MONTH 12
-#define RUBY_RELEASE_DAY 4
+#define RUBY_RELEASE_YEAR 2020
+#define RUBY_RELEASE_MONTH 3
+#define RUBY_RELEASE_DAY 31
 
 #include "ruby/version.h"
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]