Showing
1 changed file
with
5 additions
and
3 deletions
@@ -748,14 +748,16 @@ TR_malloc(size_t size) | @@ -748,14 +748,16 @@ TR_malloc(size_t size) | ||
748 | if (size < 8) { | 748 | if (size < 8) { |
749 | size = 8; | 749 | size = 8; |
750 | } else { | 750 | } else { |
751 | - size_t check = size; | ||
752 | - size_t mask = 1; | 751 | + size_t check = size >> 4; |
752 | + size_t mask = 0x1F; | ||
753 | 753 | ||
754 | while (check >>= 1) { | 754 | while (check >>= 1) { |
755 | mask = (mask << 1) | 1; | 755 | mask = (mask << 1) | 1; |
756 | } | 756 | } |
757 | 757 | ||
758 | - size = (size << 1) & ~mask; | 758 | + if (size != (size & ~(mask >> 1))) { |
759 | + size = (size << 1) & ~mask; | ||
760 | + } | ||
759 | } | 761 | } |
760 | } | 762 | } |
761 | 763 |
Please
register
or
login
to post a comment