[macruby-changes] [5053] MacRuby/trunk/string.c

source_changes at macosforge.org source_changes at macosforge.org
Sat Dec 18 19:10:50 PST 2010


Revision: 5053
          http://trac.macosforge.org/projects/ruby/changeset/5053
Author:   vincent.isambart at gmail.com
Date:     2010-12-18 19:10:47 -0800 (Sat, 18 Dec 2010)
Log Message:
-----------
some memory could be used after beeing freed

Modified Paths:
--------------
    MacRuby/trunk/string.c

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2010-12-18 08:08:32 UTC (rev 5052)
+++ MacRuby/trunk/string.c	2010-12-19 03:10:47 UTC (rev 5053)
@@ -3635,6 +3635,10 @@
 	}
     }
 
+    if (val != 0 && pos < str_chars_len) {
+	str_concat_uchars(RSTR(val), &str_chars[pos], str_chars_len - pos);
+    }
+
     if (str_chars_need_free) {
 	free(str_chars);
     }
@@ -3645,11 +3649,9 @@
     if (val == 0) {
 	return str;
     }
-
-    if (pos < str_chars_len) {
-	str_concat_uchars(RSTR(val), &str_chars[pos], str_chars_len - pos);
+    else {
+	return val;
     }
-    return val;
 }
 
 static VALUE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101218/293279b4/attachment.html>


More information about the macruby-changes mailing list