Check the return value of mrb_malloc(). #347

monaka opened this Issue Jul 6, 2012 · 1 comment


None yet

1 participant

monaka commented Jul 6, 2012

In some places, mrb_malloc() is used without return value check.
As we know, not all embedded applications have huge memory. It's highly possible mrb_malloc() returns NULL (or invalid adress) on some poor targets.

monaka commented Jan 28, 2013

The one of the solution is to add a NULL assertion check in mrb_malloc().
It is a good solution on rich platforms.
And it is not better on some tiny platforms that can't use with the debugger. We can't get C level stack trace.
So I suggest to add assertion check out of mrb_malloc(), near the crash point.

After sent this issue, I changed my opinion. I should add this kind of sanity/paranoid checks on forked version.
They are required only on critical situations.

So I close this old issue.

@monaka monaka closed this Jan 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment