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