Revision: 36852 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36852 Author: campbellbarton Date: 2011-05-24 05:59:14 +0000 (Tue, 24 May 2011) Log Message: ----------- fix for crash if scanfill fails
Modified Paths: -------------- branches/bmesh/blender/source/blender/blenlib/intern/scanfill.c Modified: branches/bmesh/blender/source/blender/blenlib/intern/scanfill.c =================================================================== --- branches/bmesh/blender/source/blender/blenlib/intern/scanfill.c 2011-05-24 05:58:12 UTC (rev 36851) +++ branches/bmesh/blender/source/blender/blenlib/intern/scanfill.c 2011-05-24 05:59:14 UTC (rev 36852) @@ -159,19 +159,22 @@ } else if(size== -1) { /*BMESH_TODO: keep the first block, gives memory leak on exit with 'newmem' */ - first = lb.first; - BLI_remlink(&lb, first); - cur= lb.first; - while(cur) { - MEM_freeN(cur->data); - cur= cur->next; + if((first= lb.first)) { /* can be false if first fill fails */ + BLI_remlink(&lb, first); + + cur= lb.first; + while(cur) { + MEM_freeN(cur->data); + cur= cur->next; + } + BLI_freelistN(&lb); + + /*reset the block we're keeping*/ + BLI_addtail(&lb, first); + memset(first->data, 0, blocksize); } - BLI_freelistN(&lb); - - /*reset the block we're keeping*/ - BLI_addtail(&lb, first); - memset(first->data, 0, blocksize); + cur= first; offs= 0; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs