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

ruby-changes:43406

From: naruse <ko1@a...>
Date: Tue, 21 Jun 2016 16:14:11 +0900 (JST)
Subject: [ruby-changes:43406] naruse:r55480 (trunk): * string.c (rb_str_casemap): fix memory leak.

naruse	2016-06-21 16:14:05 +0900 (Tue, 21 Jun 2016)

  New Revision: 55480

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55480

  Log:
    * string.c (rb_str_casemap): fix memory leak.

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 55479)
+++ string.c	(revision 55480)
@@ -5809,8 +5809,10 @@ rb_str_casemap(VALUE source, OnigCaseFol https://github.com/ruby/ruby/blob/trunk/string.c#L5809
     }
 /* fprintf(stderr, "Buffer count is %d\n", buffer_count); *//* for tuning */
 
-    if (buffer_count==1)
+    if (buffer_count==1) {
 	target = rb_str_new_with_class(source, (const char*)current_buffer->space, target_length);
+	    xfree(current_buffer);
+    }
     else {
 	char *target_current = RSTRING_PTR(target = rb_str_new_with_class(source, 0, target_length));
 	mapping_buffer *previous_buffer;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55479)
+++ ChangeLog	(revision 55480)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jun 21 16:13:45 2016  NARUSE, Yui  <naruse@r...>
+
+	* string.c (rb_str_casemap): fix memory leak.
+
 Tue Jun 21 16:12:21 2016  NARUSE, Yui  <naruse@r...>
 
 	* string.c (rb_str_casemap): int is too small for string size.

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

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