fix typo update realloc path
authorJeannot Breton <jbreton@nvidia.com>
Fri, 15 Jan 2016 17:31:10 +0000 (11:31 -0600)
committerJeannot Breton <jbreton@nvidia.com>
Fri, 15 Jan 2016 17:31:10 +0000 (11:31 -0600)
external/vulkancts/framework/vulkan/vkAllocationCallbackUtil.cpp

index 35147d828eb9253ffadcdd74c3268ae2bc31c014..1c992d47cb89c3dbbc9c7635b49bb6cd3ebe5647 100644 (file)
@@ -402,18 +402,20 @@ void validateAllocationCallbacks (const AllocationCallbackRecorder& recorder, Al
                        {
                                if (record.data.allocation.returnedPtr)
                                { 
-                                       if (!de::contains(ptrToSlotIndex, record.data.allocation.returnedPtr)) {
+                                       if (!de::contains(ptrToSlotIndex, record.data.allocation.returnedPtr))
+                                       {
                                                ptrToSlotIndex[record.data.allocation.returnedPtr] = allocations.size();
                                                allocations.push_back(AllocationSlot(record, true));
-                                       } 
-                                       else 
+                                       }
+                                       else
                                        {
                                                const size_t            slotNdx         = ptrToSlotIndex[record.data.allocation.returnedPtr];
-                                               if (!allocations[slotNdx].isLive) {
+                                               if (!allocations[slotNdx].isLive) 
+                                               {
                                                        allocations[slotNdx].isLive = true;
                                                        allocations[slotNdx].record = record;
-                                               } 
-                                               else 
+                                               }
+                                               else
                                                {
                                                        // we should not have multiple live allocations with the same pointer
                                                        DE_ASSERT(false);
@@ -451,13 +453,28 @@ void validateAllocationCallbacks (const AllocationCallbackRecorder& recorder, Al
                                                }
                                                else
                                                {
-                                                       DE_ASSERT(!de::contains(ptrToSlotIndex, record.data.reallocation.returnedPtr));
-
                                                        if (record.data.reallocation.returnedPtr)
                                                        {
                                                                allocations[origSlotNdx].isLive = false;
-                                                               ptrToSlotIndex[record.data.reallocation.returnedPtr] = allocations.size();
-                                                               allocations.push_back(AllocationSlot(record, true));
+                                                               if (!de::contains(ptrToSlotIndex, record.data.reallocation.returnedPtr))
+                                                               {
+                                                                       ptrToSlotIndex[record.data.reallocation.returnedPtr] = allocations.size();
+                                                                       allocations.push_back(AllocationSlot(record, true));
+                                                               }
+                                                               else
+                                                               {
+                                                                       const size_t slotNdx = ptrToSlotIndex[record.data.reallocation.returnedPtr];
+                                                                       if (!allocations[slotNdx].isLive)
+                                                                       {
+                                                                               allocations[slotNdx].isLive = true;
+                                                                               allocations[slotNdx].record = record;
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               // we should not have multiple live allocations with the same pointer
+                                                                               DE_ASSERT(false);
+                                                                       }
+                                                               }
                                                        }
                                                        // else original ptr remains valid and live
                                                }