Commit a3b0c5811d2766ce8cbe8bb76735dd1b2222f976

Authored by Georg Hopp
2 parents 69d9d73f 25925687

Merge branch 'master' of hosted:/var/lib/git/trbase

Showing 1 changed file with 5 additions and 3 deletions
@@ -598,14 +598,16 @@ TR_malloc(size_t size) @@ -598,14 +598,16 @@ TR_malloc(size_t size)
598 if (size < 8) { 598 if (size < 8) {
599 size = 8; 599 size = 8;
600 } else { 600 } else {
601 - size_t check = size;  
602 - size_t mask = 1; 601 + size_t check = size >> 4;
  602 + size_t mask = 0x1F;
603 603
604 while (check >>= 1) { 604 while (check >>= 1) {
605 mask = (mask << 1) | 1; 605 mask = (mask << 1) | 1;
606 } 606 }
607 607
608 - size = (size << 1) & ~mask; 608 + if (size != (size & ~(mask >> 1))) {
  609 + size = (size << 1) & ~mask;
  610 + }
609 } 611 }
610 } 612 }
611 613
Please register or login to post a comment