wrong size of filenames buffer

parent 04a2c58e
......@@ -567,7 +567,7 @@ write_filename_table(mrb_state *mrb, mrb_irep *irep, uint8_t **cp, mrb_sym **fp,
// register filename
*lp += 1;
*fp = filenames = (mrb_sym*)mrb_realloc(mrb, filenames, sizeof(mrb_sym*) * (*lp));
*fp = filenames = (mrb_sym*)mrb_realloc(mrb, filenames, sizeof(mrb_sym) * (*lp));
filenames[*lp - 1] = file->filename_sym;
// filename
......
......@@ -376,7 +376,7 @@ read_section_debug(mrb_state *mrb, const uint8_t *start, mrb_irep *irep)
filenames_len = bin_to_uint16(bin);
bin += sizeof(uint16_t);
filenames = (mrb_sym*)mrb_malloc(mrb, sizeof(mrb_sym*) * filenames_len);
filenames = (mrb_sym*)mrb_malloc(mrb, sizeof(mrb_sym) * filenames_len);
for(i = 0; i < filenames_len; ++i) {
uint16_t f_len = bin_to_uint16(bin);
bin += sizeof(uint16_t);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment