From 3d20691b8156007a5f5fc94736edabb64ec31ada Mon Sep 17 00:00:00 2001 From: surkeh Date: Thu, 19 Apr 2018 04:28:20 -0700 Subject: [PATCH] Added missing free for newBatches malloc --- demo/extractmesh.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); }