* ext/syck/rubyext.c: sorry, I reverted my "should set newly
allocated memory instead of RString's internal storage" stuff. node allocated in rubyext.c seems to be freed by rb_syck_free_node not syck_free_node, and it won't free data.str->ptr and type_id. (I still think this is unsafe because RString(foo)->ptr becomes dangling pointer when RString is modified or freed, but anyway I misunderstood, so go back to original code for now) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8ed2a927e8
commit
af5edce080
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
Mon Dec 19 11:37:47 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
|
* ext/syck/rubyext.c: sorry, I reverted my "should set newly
|
||||||
|
allocated memory instead of RString's internal storage" stuff.
|
||||||
|
node allocated in rubyext.c seems to be freed by rb_syck_free_node
|
||||||
|
not syck_free_node, and it won't free data.str->ptr and type_id.
|
||||||
|
|
||||||
|
(I still think this is unsafe because RString(foo)->ptr becomes
|
||||||
|
dangling pointer when RString is modified or freed, but anyway
|
||||||
|
I misunderstood, so go back to original code for now)
|
||||||
|
|
||||||
Sat Dec 17 21:50:41 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
Sat Dec 17 21:50:41 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
* ext/syck/rubyext.c (syck_emitter_reset): should initialize
|
* ext/syck/rubyext.c (syck_emitter_reset): should initialize
|
||||||
|
@ -1536,7 +1536,7 @@ syck_scalar_value_set( self, val )
|
|||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
|
||||||
StringValue( val );
|
StringValue( val );
|
||||||
node->data.str->ptr = syck_strndup( RSTRING(val)->ptr, RSTRING(val)->len );
|
node->data.str->ptr = RSTRING(val)->ptr;
|
||||||
node->data.str->len = RSTRING(val)->len;
|
node->data.str->len = RSTRING(val)->len;
|
||||||
node->data.str->style = scalar_none;
|
node->data.str->style = scalar_none;
|
||||||
|
|
||||||
@ -1805,13 +1805,10 @@ syck_node_type_id_set( self, type_id )
|
|||||||
SyckNode *node;
|
SyckNode *node;
|
||||||
Data_Get_Struct( self, SyckNode, node );
|
Data_Get_Struct( self, SyckNode, node );
|
||||||
|
|
||||||
if ( node->type_id != NULL ) S_FREE( node->type_id );
|
|
||||||
|
|
||||||
if ( NIL_P( type_id ) ) {
|
if ( NIL_P( type_id ) ) {
|
||||||
node->type_id = NULL;
|
node->type_id = NULL;
|
||||||
} else {
|
} else {
|
||||||
StringValue( type_id );
|
node->type_id = StringValuePtr( type_id );
|
||||||
node->type_id = syck_strndup( RSTRING(type_id)->ptr, RSTRING(type_id)->len );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_iv_set( self, "@type_id", type_id );
|
rb_iv_set( self, "@type_id", type_id );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user