ruby-changes:57997
From: nagachika <ko1@a...>
Date: Sat, 28 Sep 2019 13:33:05 +0900 (JST)
Subject: [ruby-changes:57997] 78ef2d0f33 (ruby_2_6): merge revision(s) 8b3774be3dd9f472bddd99e84e3c9fe2ff99d7ac: [Backport #15935]
https://git.ruby-lang.org/ruby.git/commit/?id=78ef2d0f33 From 78ef2d0f331c3e056ee367214710b41722de2fe0 Mon Sep 17 00:00:00 2001 From: nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Sat, 28 Sep 2019 04:32:46 +0000 Subject: 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 diff --git a/string.c b/string.c index 6651dce..76a6ae0 100644 --- a/string.c +++ b/string.c @@ -2095,7 +2095,7 @@ static void https://github.com/ruby/ruby/blob/trunk/string.c#L2095 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; @@ -2114,6 +2114,9 @@ str_make_independent_expand(VALUE str, long len, long expand, const int termlen) https://github.com/ruby/ruby/blob/trunk/string.c#L2114 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 76309cb..61b7a7b 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.6.5" #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 109 +#define RUBY_PATCHLEVEL 110 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 9 -#define RUBY_RELEASE_DAY 27 +#define RUBY_RELEASE_DAY 28 #include "ruby/version.h" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/