The attached patch fixes the following issues:
Check pointers returned by malloc. It may return NULL on allocation failure.
Replace random size check. 40Mb is just random and it can easily be hit in the real world.
Use 4G instead, which is a better limit (32-bit address space limit).
If the machine does not have enough memory, malloc will tell us. There's no need to
check against randomly chosen limits before mallocing.
Log in to post a comment.