Fix T45439 crash with subsurf when many materials present.
authorAntony Riakiotakis <kalast@gmail.com>
Wed, 15 Jul 2015 12:57:49 +0000 (14:57 +0200)
committerAntony Riakiotakis <kalast@gmail.com>
Wed, 15 Jul 2015 12:58:10 +0000 (14:58 +0200)
Silly oversight on the viewport patch

source/blender/blenkernel/intern/subsurf_ccg.c

index d089660b83ab0157fe98514b6bf1644cae71be53..0b0c011bf5a450565b9fb8fe5c5fbf9f767c79ed 100644 (file)
@@ -2197,7 +2197,7 @@ static GPUDrawObject *ccgDM_GPUObjectNew(DerivedMesh *dm)
                        gdo->materials[curmat].totloops = matinfo[i].loops;
                        gdo->materials[curmat].mat_nr = i;
                        gdo->materials[curmat].totpolys = matinfo[i].polys;
-                       gdo->materials[curmat].polys = MEM_mallocN(sizeof(int) * matinfo[0].polys, "GPUBufferMaterial.polys");
+                       gdo->materials[curmat].polys = MEM_mallocN(sizeof(int) * matinfo[i].polys, "GPUBufferMaterial.polys");
 
                        curelement += matinfo[i].elements;
                        curmat++;