From 6fca57dd06d5db056bf9ac7c07474e32b4fb80e1 Mon Sep 17 00:00:00 2001 From: ocean Date: Fri, 16 Dec 2005 02:45:35 +0000 Subject: * ext/syck/rubyext.c (syck_resolver_tagurize): fixed memory leak. * ext/syck/rubyext.c (syck_node_type_id_set): should set newly allocated memory instead of RString's internal storage. ... these fixes won't fix [ruby-dev:27839]. more work is needed. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/syck/rubyext.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'ext') diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c index cf183dab5..e45d4971f 100644 --- a/ext/syck/rubyext.c +++ b/ext/syck/rubyext.c @@ -1191,10 +1191,9 @@ syck_resolver_tagurize( self, val ) if ( !NIL_P(tmp) ) { - char *taguri; - val = tmp; - taguri = syck_type_id_to_uri( RSTRING(val)->ptr ); - return rb_str_new2( taguri ); + char *taguri = syck_type_id_to_uri( RSTRING(tmp)->ptr ); + val = rb_str_new2( taguri ); + S_FREE( taguri ); } return val; @@ -1405,7 +1404,9 @@ syck_node_mark( n ) } break; } - rb_gc_mark_maybe( n->shortcut ); +#if 0 /* maybe needed */ + if ( n->shortcut ) syck_node_mark( n->shortcut ); /* caution: maybe cyclic */ +#endif } /* @@ -1795,7 +1796,8 @@ syck_node_type_id_set( self, type_id ) if ( NIL_P( type_id ) ) { node->type_id = NULL; } else { - node->type_id = StringValuePtr( type_id ); + StringValue( type_id ); + node->type_id = syck_strndup( RSTRING(type_id)->ptr, RSTRING(type_id)->len ); } rb_iv_set( self, "@type_id", type_id ); -- cgit