From 7680ca8d2612a6a5e452f616e271ef3c02bec3f6 Mon Sep 17 00:00:00 2001 From: ocean Date: Fri, 16 Dec 2005 02:45:35 +0000 Subject: [PATCH] * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@9697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 14 ++++++++++++-- ext/syck/rubyext.c | 14 ++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 875f4eb754..b1b9e6e76d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Fri Dec 16 11:44:43 2005 Hirokazu Yamamoto + + * 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. + Thu Dec 15 12:35:14 2005 Yukihiro Matsumoto * lib/tmpdir.rb: merged RDoc patch from Eric Hodel * gc.c (ruby_xrealloc2): ditto. -Tue Dec 4 16:37:57 2005 Yuya Nishida +Tue Dec 6 16:37:57 2005 Yuya Nishida * eval.c (exec_under): avoid accessing ruby_frame->prev. [ruby-dev:27948] @@ -2988,7 +2997,8 @@ Sat Jul 30 18:49:44 2005 Masaki Suketa * ext/win32ole/tests/testOLETYPE.rb: ditto. -Fri Jul 29 16:12:02 005 Keiju Ishitsuka +Fri Jul 29 16:12:02 2005 Keiju Ishitsuka + * lib/irb/context.rb: fix `irb --readline` option. [ruby-dev:40955] Fri Jul 29 09:59:38 2005 Nobuyoshi Nakada diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c index cf183dab52..e45d4971f2 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 );