BLI_memiter: unpoison memory before freeing it
authorJacques Lucke <mail@jlucke.com>
Wed, 22 May 2019 10:33:15 +0000 (12:33 +0200)
committerJacques Lucke <mail@jlucke.com>
Wed, 22 May 2019 10:33:30 +0000 (12:33 +0200)
source/blender/blenlib/intern/BLI_memiter.c

index c7df7d5..2d3ba56 100644 (file)
@@ -239,6 +239,10 @@ static void memiter_free_data(BLI_memiter *mi)
   BLI_memiter_chunk *chunk = mi->head;
   while (chunk) {
     BLI_memiter_chunk *chunk_next = chunk->next;
+
+    /* Unpoison memory because MEM_freeN might overwrite it. */
+    ASAN_UNPOISON_MEMORY_REGION(chunk, MEM_allocN_len(chunk));
+
     MEM_freeN(chunk);
     chunk = chunk_next;
   }