From e3a9e9b7d6915f604216d8c48b240fa0efcfa56a Mon Sep 17 00:00:00 2001 From: Masaki Muranaka Date: Thu, 25 Apr 2013 16:57:19 +0900 Subject: Add comments why there is no need to put the SIZE_ERROR check. It is for reviews in the future. --- src/load.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/load.c b/src/load.c index 63517769a..a5a1aa644 100644 --- a/src/load.c +++ b/src/load.c @@ -415,6 +415,7 @@ read_rite_section_lineno_file(mrb_state *mrb, FILE *fp, size_t sirep) nirep = bin_to_uint16(header.nirep); buf_size = record_header_size; + /* We don't need to check buf_size. As it is enough small. */ buf = (uint8_t *)mrb_malloc(mrb, buf_size); if (!buf) { result = MRB_DUMP_GENERAL_FAILURE; @@ -482,6 +483,7 @@ read_rite_section_irep_file(mrb_state *mrb, FILE *fp) nirep = bin_to_uint16(header.nirep); buf_size = record_header_size; + /* You don't need use SIZE_ERROR as buf_size is enough small. */ buf = (uint8_t *)mrb_malloc(mrb, buf_size); if (!buf) { result = MRB_DUMP_GENERAL_FAILURE; @@ -547,6 +549,7 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp) return MRB_DUMP_INVALID_ARGUMENT; } + /* You don't need use SIZE_ERROR as buf_size is enough small. */ buf = mrb_malloc(mrb, buf_size); if (!buf) { return MRB_DUMP_GENERAL_FAILURE; @@ -563,6 +566,7 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp) /* verify CRC */ fpos = ftell(fp); + /* You don't need use SIZE_ERROR as block_size is enough small. */ buf = mrb_malloc(mrb, block_size); if (!buf) { return MRB_DUMP_GENERAL_FAILURE; -- cgit v1.2.3