mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	transcode.c: GC guards
* transcode.c (econv_init): add guards to prevent source encoding name and destination encoding name from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									3969b1861c
								
							
						
					
					
						commit
						b55217c691
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -3391,7 +3391,10 @@ econv_init(int argc, VALUE *argv, VALUE self)
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    if (!ec) {
 | 
			
		||||
        rb_exc_raise(rb_econv_open_exc(sname, dname, ecflags));
 | 
			
		||||
	VALUE exc = rb_econv_open_exc(sname, dname, ecflags);
 | 
			
		||||
	RB_GC_GUARD(snamev);
 | 
			
		||||
	RB_GC_GUARD(dnamev);
 | 
			
		||||
	rb_exc_raise(exc);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!DECORATOR_P(sname, dname)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -3399,6 +3402,8 @@ econv_init(int argc, VALUE *argv, VALUE self)
 | 
			
		|||
            senc = make_dummy_encoding(sname);
 | 
			
		||||
        if (!denc)
 | 
			
		||||
            denc = make_dummy_encoding(dname);
 | 
			
		||||
	RB_GC_GUARD(snamev);
 | 
			
		||||
	RB_GC_GUARD(dnamev);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ec->source_encoding = senc;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue