Check the return value of mrb_malloc(). #347

Closed
monaka opened this Issue Jul 6, 2012 · 1 comment

Projects

None yet

1 participant

@monaka
Contributor
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
Contributor
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.

But.
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