Fix image paint undo memory leak
authorCampbell Barton <ideasman42@gmail.com>
Thu, 31 Jan 2019 01:35:12 +0000 (12:35 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 31 Jan 2019 01:35:40 +0000 (12:35 +1100)
source/blender/editors/sculpt_paint/paint_image_undo.c

index 25f5d91..0cf5672 100644 (file)
@@ -346,10 +346,10 @@ static void image_undo_restore_list(ListBase *lb, struct UndoIDPtrMap *id_map)
 
 static void image_undo_free_list(ListBase *lb)
 {
-       UndoImageTile *tile;
-
-       for (tile = lb->first; tile; tile = tile->next) {
+       for (UndoImageTile *tile = lb->first, *tile_next; tile; tile = tile_next) {
+               tile_next = tile->next;
                MEM_freeN(tile->rect.pt);
+               MEM_freeN(tile);
        }
 }