aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-08 17:19:58 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-08 17:19:58 +0000
commite78bf7976c0269e8b54165c374fcba7ee68a4d2b (patch)
treec8891c07ebcd0d4f9186b7e97b4eb1cf335244fe /compile.c
parent4466d4baa94bb23f0cfb9aa48252a5ce0b6a1976 (diff)
downloadruby-e78bf7976c0269e8b54165c374fcba7ee68a4d2b.tar.gz
* compile.c (ibf_dump_memsize): should check NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/compile.c b/compile.c
index 83132b741c..517b500996 100644
--- a/compile.c
+++ b/compile.c
@@ -8054,11 +8054,16 @@ ibf_dump_free(void *ptr)
static size_t
ibf_dump_memsize(const void *ptr)
{
- struct ibf_dump *dump = (struct ibf_dump *)ptr;
- size_t size = sizeof(*dump);
- if (dump->iseq_table) size += st_memsize(dump->iseq_table);
- if (dump->id_table) size += st_memsize(dump->id_table);
- return size;
+ if (ptr) {
+ struct ibf_dump *dump = (struct ibf_dump *)ptr;
+ size_t size = sizeof(*dump);
+ if (dump->iseq_table) size += st_memsize(dump->iseq_table);
+ if (dump->id_table) size += st_memsize(dump->id_table);
+ return size;
+ }
+ else {
+ return 0;
+ }
}
static const rb_data_type_t ibf_dump_type = {