Re #691: splitOb() fixed memory allocation bug (Boris)

o size of memory to be allocated for temporary arrays was wrong (too much)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4862 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 379f203e90a91495ee55c286e86fe8f241d94363
Former-commit-id: e25ffc78a3632c72cc47260c5a67b81aeeaf5969
This commit is contained in:
kmetykog 2012-08-17 22:07:26 +00:00
parent e5dcaa33a9
commit d9233f16de

View file

@ -543,6 +543,7 @@ int splitOb(ob_t **object)
int m1, m2, m3;
int touse = 0;
int orignumtris = 0; /* number of surfaces/triangles in the source object */
int orignumverts = 0; /* number of vertices in the source object: orignumtris * 3 */
int * tri;
int numvertstored = 0; /* number of vertices stored in the object */
int numtristored = 0; /* number of triangles stored in the object: numvertstored/3 */
@ -556,13 +557,14 @@ int splitOb(ob_t **object)
int curvert = 0;
orignumtris = (*object)->numsurf;
orignumverts = orignumtris * 3;
tri = (int *) calloc(orignumtris, sizeof(int));
vatmp = (tcoord_t *) calloc(4 * orignumtris, sizeof(tcoord_t));
pttmp = (point_t *) calloc(4 * orignumtris, sizeof(point_t));
oldva = (int *) calloc(4 * orignumtris, sizeof(int));
snorm = (point_t *) calloc(4 * orignumtris, sizeof(point_t));
text = (double *) calloc(3 * orignumtris, sizeof(double));
vatmp = (tcoord_t *) calloc(orignumverts, sizeof(tcoord_t));
pttmp = (point_t *) calloc(orignumverts, sizeof(point_t));
oldva = (int *) calloc(orignumverts, sizeof(int));
snorm = (point_t *) calloc(orignumverts, sizeof(point_t));
text = (double *) calloc(2*orignumverts, sizeof(double));
while (mustcontinue == 1)
{