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

ruby-changes:20301

From: naruse <ko1@a...>
Date: Fri, 1 Jul 2011 14:28:57 +0900 (JST)
Subject: [ruby-changes:20301] naruse:r32349 (trunk): * string.c (tr_trans): free heap ptr when the str is not embeded.

naruse	2011-07-01 14:28:48 +0900 (Fri, 01 Jul 2011)

  New Revision: 32349

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32349

  Log:
    * string.c (tr_trans): free heap ptr when the str is not embeded.
      patched by Eric Wong. [Bug #4956] [ruby-core:37708]

  Modified files:
    trunk/ChangeLog
    trunk/string.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32348)
+++ ChangeLog	(revision 32349)
@@ -1,3 +1,8 @@
+Fri Jul  1 11:41:12 2011  NARUSE, Yui  <naruse@r...>
+
+	* string.c (tr_trans): free heap ptr when the str is not embeded.
+	  patched by Eric Wong. [Bug #4956] [ruby-core:37708]
+
 Fri Jul  1 11:07:43 2011  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* thread.c (do_select): fix memory leak.
Index: string.c
===================================================================
--- string.c	(revision 32348)
+++ string.c	(revision 32349)
@@ -5117,6 +5117,9 @@
 	    CHECK_IF_ASCII(c);
 	    t += tlen;
 	}
+	if (!STR_EMBED_P(str)) {
+	    xfree(RSTRING(str)->as.heap.ptr);
+	}
 	*t = '\0';
 	RSTRING(str)->as.heap.ptr = buf;
 	RSTRING(str)->as.heap.len = t - buf;

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

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