Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in time_alloc #4308

clayton-shopify opened this issue Mar 1, 2019 · 0 comments

Memory leak in time_alloc #4308

clayton-shopify opened this issue Mar 1, 2019 · 0 comments


Copy link

The following input demonstrates a memory leak:

loop do
rescue ArgumentError

It appears the issue occurs because mrb_malloc is called here:

tm = (struct mrb_time *)mrb_malloc(mrb, sizeof(struct mrb_time));

After that, a call to time_update_datetime is made:
time_update_datetime(mrb, tm);

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 (

@matz matz closed this as completed in ca0dcbb Mar 2, 2019
ksekimoto added a commit to ksekimoto/mruby that referenced this issue Jul 16, 2021
To avoid memory leak from `time_update_datetime`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

1 participant