diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-07 03:23:25 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-07 03:23:25 +0000 |
commit | 8eb96c613718beea355e8cc2f2c7e3672f13eb8e (patch) | |
tree | 80deb3d53a3c7852d1c05927030f09ec5e98ff94 /ext | |
parent | 870c296d00cc5e94d7371a490fbf2823f005b5b0 (diff) | |
download | ruby-8eb96c613718beea355e8cc2f2c7e3672f13eb8e.tar.gz |
ext/objspace/object_tracing.c (freeobj_i): no lookup before delete
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/objspace/object_tracing.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c index 00b33caa79..0c268b114a 100644 --- a/ext/objspace/object_tracing.c +++ b/ext/objspace/object_tracing.c @@ -121,13 +121,14 @@ freeobj_i(VALUE tpval, void *data) st_data_t v; struct allocation_info *info; - if (st_lookup(arg->object_table, obj, &v)) { - info = (struct allocation_info *)v; - if (arg->keep_remains) { + if (arg->keep_remains) { + if (st_lookup(arg->object_table, obj, &v)) { + info = (struct allocation_info *)v; info->living = 0; } - else { - st_delete(arg->object_table, &obj, &v); + } + else { + if (st_delete(arg->object_table, &obj, &v)) { delete_unique_str(arg->str_table, info->path); delete_unique_str(arg->str_table, info->class_path); ruby_xfree(info); |