The following input demonstrates a memory leak: ```ruby loop do Time.at(100000000000000000) rescue ArgumentError end ``` It appears the issue occurs because `mrb_malloc` is called here: https://github.com/mruby/mruby/blob/48fb239efb19e40c356b9e06a7c34f6bc9d79b22/mrbgems/mruby-time/src/time.c#L262 After that, a call to `time_update_datetime` is made: https://github.com/mruby/mruby/blob/48fb239efb19e40c356b9e06a7c34f6bc9d79b22/mrbgems/mruby-time/src/time.c#L276 But `time_update_datetime` raises if the input value is out of range, and in that case it seems that `tm` leaks. This issue was reported by Bhargava Shastry (https://hackerone.com/bags).
Activity
Free `struct mrb_time` before error; fix mruby#4308