[macruby-changes] [5030] MacRuby/trunk/ext/json/rubyext.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Dec 15 00:38:46 PST 2010


Revision: 5030
          http://trac.macosforge.org/projects/ruby/changeset/5030
Author:   watson1978 at gmail.com
Date:     2010-12-15 00:38:42 -0800 (Wed, 15 Dec 2010)
Log Message:
-----------
Fixed the crash bug. yajl_free() should not called with NULL pointer.

Modified Paths:
--------------
    MacRuby/trunk/ext/json/rubyext.c

Modified: MacRuby/trunk/ext/json/rubyext.c
===================================================================
--- MacRuby/trunk/ext/json/rubyext.c	2010-12-15 07:48:57 UTC (rev 5029)
+++ MacRuby/trunk/ext/json/rubyext.c	2010-12-15 08:38:42 UTC (rev 5030)
@@ -155,7 +155,9 @@
 {
     // TODO: is this reentrant?
     rb_json_parser_t* parser = RJSONParser(rcv);
-    yajl_free(parser->parser);
+    if(parser->parser != NULL) {
+	yajl_free(parser->parser);
+    }
 
     if (rb_json_parser_finalize_super) {
         ((void(*)(void*, SEL))rb_json_parser_finalize_super)(rcv, sel);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101215/3a50f37a/attachment.html>


More information about the macruby-changes mailing list