diff options
| author | Masaki Muranaka <[email protected]> | 2013-04-25 16:57:19 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2013-04-25 16:57:19 +0900 |
| commit | e3a9e9b7d6915f604216d8c48b240fa0efcfa56a (patch) | |
| tree | d82bca752bcc0b1b0c39a82e9e8fb0007a2cde80 | |
| parent | 682d52b786b6062fe21a62bfb018c9d876c09f6e (diff) | |
| download | mruby-e3a9e9b7d6915f604216d8c48b240fa0efcfa56a.tar.gz mruby-e3a9e9b7d6915f604216d8c48b240fa0efcfa56a.zip | |
Add comments why there is no need to put the SIZE_ERROR check. It is for reviews in the future.
| -rw-r--r-- | src/load.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |
