summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-16 12:56:48 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-16 12:56:48 (GMT)
commit6fb9349d85960858023eb9c16826b68408279175 (patch)
tree0ad55fedb988498028a4f7ded7ff773c2667cca4 /variable.c
parentcb54008be67547866fa7a552a3eff5059d34c1b3 (diff)
allocate structs with wrapper
* parse.y (rb_parser_new, ripper_s_allocate): allocate structs with making new wrapper objects and get rid of potential memory leak. * variable.c (rb_autoload): ditto. * ext/digest/digest.c (rb_digest_base_alloc): ditto. * ext/strscan/strscan.c (strscan_s_allocate): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/variable.c b/variable.c
index 9b5a326..8514c5e 100644
--- a/variable.c
+++ b/variable.c
@@ -1682,12 +1682,11 @@ rb_autoload(VALUE mod, ID id, const char *file)
FL_UNSET(fn, FL_TAINT);
OBJ_FREEZE(fn);
- ele = ALLOC(struct autoload_data_i);
+ ad = TypedData_Make_Struct(0, struct autoload_data_i, &autoload_data_i_type, ele);
ele->feature = fn;
ele->safe_level = rb_safe_level();
ele->thread = Qnil;
ele->value = Qundef;
- ad = TypedData_Wrap_Struct(0, &autoload_data_i_type, ele);
st_insert(tbl, (st_data_t)id, (st_data_t)ad);
}