574 if (size == 0) { |
574 if (size == 0) { |
575 // return a valid pointer if size is zero |
575 // return a valid pointer if size is zero |
576 // if NULL is returned the calling functions assume out of memory. |
576 // if NULL is returned the calling functions assume out of memory. |
577 size = 1; |
577 size = 1; |
578 } |
578 } |
579 |
579 if (size > size + space_before + space_after) { // Check for rollover. |
|
580 return NULL; |
|
581 } |
580 NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap()); |
582 NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap()); |
581 u_char* ptr = (u_char*)::malloc(size + space_before + space_after); |
583 u_char* ptr = (u_char*)::malloc(size + space_before + space_after); |
582 |
584 |
583 #ifdef ASSERT |
585 #ifdef ASSERT |
584 if (ptr == NULL) return NULL; |
586 if (ptr == NULL) return NULL; |