mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Multiple call of the initialize.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
45a08a4296
commit
9dab5bc3b0
3 changed files with 9 additions and 0 deletions
|
|
@ -202,6 +202,10 @@ rb_dlptr_initialize(int argc, VALUE argv[], VALUE self)
|
|||
|
||||
if( p ){
|
||||
Data_Get_Struct(self, struct ptr_data, data);
|
||||
if( data->ptr && data->free ){
|
||||
/* Free previous memory. Use of inappropriate initialize may cause SEGV. */
|
||||
(*(data->free))(data->ptr);
|
||||
}
|
||||
data->ptr = p;
|
||||
data->size = s;
|
||||
data->free = f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue