| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 partitionCookieCheckValue(ptr); | 762 partitionCookieCheckValue(ptr); |
| 763 partitionCookieCheckValue(reinterpret_cast<char*>(ptr) + slotSize - | 763 partitionCookieCheckValue(reinterpret_cast<char*>(ptr) + slotSize - |
| 764 kCookieSize); | 764 kCookieSize); |
| 765 memset(ptr, kFreedByte, slotSize); | 765 memset(ptr, kFreedByte, slotSize); |
| 766 #endif | 766 #endif |
| 767 ASSERT(page->numAllocatedSlots); | 767 ASSERT(page->numAllocatedSlots); |
| 768 PartitionFreelistEntry* freelistHead = page->freelistHead; | 768 PartitionFreelistEntry* freelistHead = page->freelistHead; |
| 769 ASSERT(!freelistHead || partitionPointerIsValid(freelistHead)); | 769 ASSERT(!freelistHead || partitionPointerIsValid(freelistHead)); |
| 770 SECURITY_CHECK(ptr != freelistHead); // Catches an immediate double free. | 770 SECURITY_CHECK(ptr != freelistHead); // Catches an immediate double free. |
| 771 // Look for double free one level deeper in debug. | 771 // Look for double free one level deeper in debug. |
| 772 ASSERT_WITH_SECURITY_IMPLICATION( | 772 SECURITY_DCHECK(!freelistHead || |
| 773 !freelistHead || ptr != partitionFreelistMask(freelistHead->next)); | 773 ptr != partitionFreelistMask(freelistHead->next)); |
| 774 PartitionFreelistEntry* entry = static_cast<PartitionFreelistEntry*>(ptr); | 774 PartitionFreelistEntry* entry = static_cast<PartitionFreelistEntry*>(ptr); |
| 775 entry->next = partitionFreelistMask(freelistHead); | 775 entry->next = partitionFreelistMask(freelistHead); |
| 776 page->freelistHead = entry; | 776 page->freelistHead = entry; |
| 777 --page->numAllocatedSlots; | 777 --page->numAllocatedSlots; |
| 778 if (UNLIKELY(page->numAllocatedSlots <= 0)) { | 778 if (UNLIKELY(page->numAllocatedSlots <= 0)) { |
| 779 partitionFreeSlowPath(page); | 779 partitionFreeSlowPath(page); |
| 780 } else { | 780 } else { |
| 781 // All single-slot allocations must go through the slow path to | 781 // All single-slot allocations must go through the slow path to |
| 782 // correctly update the size metadata. | 782 // correctly update the size metadata. |
| 783 ASSERT(partitionPageGetRawSize(page) == 0); | 783 ASSERT(partitionPageGetRawSize(page) == 0); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 using WTF::partitionAlloc; | 948 using WTF::partitionAlloc; |
| 949 using WTF::partitionFree; | 949 using WTF::partitionFree; |
| 950 using WTF::partitionAllocGeneric; | 950 using WTF::partitionAllocGeneric; |
| 951 using WTF::partitionFreeGeneric; | 951 using WTF::partitionFreeGeneric; |
| 952 using WTF::partitionReallocGeneric; | 952 using WTF::partitionReallocGeneric; |
| 953 using WTF::partitionAllocActualSize; | 953 using WTF::partitionAllocActualSize; |
| 954 using WTF::partitionAllocSupportsGetSize; | 954 using WTF::partitionAllocSupportsGetSize; |
| 955 using WTF::partitionAllocGetSize; | 955 using WTF::partitionAllocGetSize; |
| 956 | 956 |
| 957 #endif // WTF_PartitionAlloc_h | 957 #endif // WTF_PartitionAlloc_h |
| OLD | NEW |