diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-12-16 02:45:35 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-12-16 02:45:35 +0000 |
commit | 6fca57dd06d5db056bf9ac7c07474e32b4fb80e1 (patch) | |
tree | 3e16fa966413ac05f9f75cd65bb45106dd1d8485 /ext/syck | |
parent | f7ab018fb56811e9a181593276602a114ba789bb (diff) | |
download | ruby-6fca57dd06d5db056bf9ac7c07474e32b4fb80e1.tar.gz ruby-6fca57dd06d5db056bf9ac7c07474e32b4fb80e1.tar.xz ruby-6fca57dd06d5db056bf9ac7c07474e32b4fb80e1.zip |
* 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
Diffstat (limited to 'ext/syck')
-rw-r--r-- | ext/syck/rubyext.c | 14 |
1 files changed, 8 insertions, 6 deletions
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 ); |