diff --git a/demo/extractmesh.c b/demo/extractmesh.c index d34a8a6..8468a42 100644 --- a/demo/extractmesh.c +++ b/demo/extractmesh.c @@ -21,8 +21,10 @@ void writemesh(const struct MeshHeader *mh, write(fn, (char*)(&h), sizeof(struct Header)); append(fn, (char*)(&newmh), sizeof(struct MeshHeader)); - struct BatchData * newBatches = malloc(newmh.numBatch * sizeof(struct BatchData)); + + // batch data the same treatment. + struct BatchData * newBatches = malloc(newmh.numBatch * sizeof(struct BatchData)); uint64_t previousBatch = 0; for (int i = 0; i < newmh.numBatch; 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); } + free(newBatches); free(fn); }