[macruby-changes] [5191] MacRuby/trunk/dispatcher.cpp

source_changes at macosforge.org source_changes at macosforge.org
Tue Jan 25 16:43:26 PST 2011


Revision: 5191
          http://trac.macosforge.org/projects/ruby/changeset/5191
Author:   lsansonetti at apple.com
Date:     2011-01-25 16:43:25 -0800 (Tue, 25 Jan 2011)
Log Message:
-----------
fix a bug in the dispatcher where free'd memory would be accessed (patch by justin at sweetspotdiabetes.com)

Modified Paths:
--------------
    MacRuby/trunk/dispatcher.cpp

Modified: MacRuby/trunk/dispatcher.cpp
===================================================================
--- MacRuby/trunk/dispatcher.cpp	2011-01-25 21:16:25 UTC (rev 5190)
+++ MacRuby/trunk/dispatcher.cpp	2011-01-26 00:43:25 UTC (rev 5191)
@@ -690,7 +690,6 @@
 		    strncpy(tmp, selname, p - selname + 1);
 		    tmp[p - selname + 1] = '\0';
 		    sel = sel_registerName(tmp);
-		    free(tmp);
 		    VALUE h = rb_hash_new();
 		    bool ok = true;
 		    p += 1;
@@ -705,6 +704,8 @@
 			p = p2 + 1; 
 			rb_hash_aset(h, ID2SYM(rb_intern(tmp)), argv[i]);
 		    }
+		    free(tmp);
+		    tmp = NULL;
 		    if (ok) {
 			argc = 2;
 			((VALUE *)argv)[1] = h; // bad, I know...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110125/ca0840fb/attachment.html>


More information about the macruby-changes mailing list