forked from speed-dreams/speed-dreams-code
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:
parent
e5dcaa33a9
commit
d9233f16de
1 changed files with 7 additions and 5 deletions
|
@ -543,6 +543,7 @@ int splitOb(ob_t **object)
|
||||||
int m1, m2, m3;
|
int m1, m2, m3;
|
||||||
int touse = 0;
|
int touse = 0;
|
||||||
int orignumtris = 0; /* number of surfaces/triangles in the source object */
|
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 * tri;
|
||||||
int numvertstored = 0; /* number of vertices stored in the object */
|
int numvertstored = 0; /* number of vertices stored in the object */
|
||||||
int numtristored = 0; /* number of triangles stored in the object: numvertstored/3 */
|
int numtristored = 0; /* number of triangles stored in the object: numvertstored/3 */
|
||||||
|
@ -556,13 +557,14 @@ int splitOb(ob_t **object)
|
||||||
int curvert = 0;
|
int curvert = 0;
|
||||||
|
|
||||||
orignumtris = (*object)->numsurf;
|
orignumtris = (*object)->numsurf;
|
||||||
|
orignumverts = orignumtris * 3;
|
||||||
|
|
||||||
tri = (int *) calloc(orignumtris, sizeof(int));
|
tri = (int *) calloc(orignumtris, sizeof(int));
|
||||||
vatmp = (tcoord_t *) calloc(4 * orignumtris, sizeof(tcoord_t));
|
vatmp = (tcoord_t *) calloc(orignumverts, sizeof(tcoord_t));
|
||||||
pttmp = (point_t *) calloc(4 * orignumtris, sizeof(point_t));
|
pttmp = (point_t *) calloc(orignumverts, sizeof(point_t));
|
||||||
oldva = (int *) calloc(4 * orignumtris, sizeof(int));
|
oldva = (int *) calloc(orignumverts, sizeof(int));
|
||||||
snorm = (point_t *) calloc(4 * orignumtris, sizeof(point_t));
|
snorm = (point_t *) calloc(orignumverts, sizeof(point_t));
|
||||||
text = (double *) calloc(3 * orignumtris, sizeof(double));
|
text = (double *) calloc(2*orignumverts, sizeof(double));
|
||||||
|
|
||||||
while (mustcontinue == 1)
|
while (mustcontinue == 1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue