Added missing free for newBatches malloc

This commit is contained in:
surkeh 2018-04-19 04:28:20 -07:00
parent 2257f7f034
commit 3d20691b81

View File

@ -21,8 +21,10 @@ void writemesh(const struct MeshHeader *mh,
write(fn, (char*)(&h), sizeof(struct Header)); write(fn, (char*)(&h), sizeof(struct Header));
append(fn, (char*)(&newmh), sizeof(struct MeshHeader)); append(fn, (char*)(&newmh), sizeof(struct MeshHeader));
struct BatchData * newBatches = malloc(newmh.numBatch * sizeof(struct BatchData));
// batch data the same treatment. // batch data the same treatment.
struct BatchData * newBatches = malloc(newmh.numBatch * sizeof(struct BatchData));
uint64_t previousBatch = 0; uint64_t previousBatch = 0;
for (int i = 0; i < newmh.numBatch; i++) { for (int i = 0; i < newmh.numBatch; i++) {
newBatches[i] = (m -> b) -> bd[i]; newBatches[i] = (m -> b) -> bd[i];
@ -51,6 +53,7 @@ void writemesh(const struct MeshHeader *mh,
append(fn, (char*)(m -> b[i].vd.bw), sizeof(struct BoneWeights) * nVertices); append(fn, (char*)(m -> b[i].vd.bw), sizeof(struct BoneWeights) * nVertices);
} }
free(newBatches);
free(fn); free(fn);
} }