Skip to content

Conversation

musicinmybrain
Copy link
Contributor

This appears to be a clear-cut case of accidentally calling free on a dangling pointer.

GCC reported:

compressMG1.c: In function ‘_ctmCompressMesh_MG1’: compressMG1.c:188:5: warning: pointer ‘indices_45’ may be used after ‘free’ [-Wuse-after-free]
  188 |     free((void *) indices);
      |     ^~~~~~~~~~~~~~~~~~~~~~
compressMG1.c:179:3: note: call to ‘free’ here
  179 |   free((void *) indices);
      |   ^~~~~~~~~~~~~~~~~~~~~~

and indeed, the conditional call to free removed in this PR appears a few lines after an unconditional free in

free((void *) indices);

GCC reported:

compressMG1.c: In function ‘_ctmCompressMesh_MG1’:
compressMG1.c:188:5: warning: pointer ‘indices_45’ may be used after ‘free’ [-Wuse-after-free]
  188 |     free((void *) indices);
      |     ^~~~~~~~~~~~~~~~~~~~~~
compressMG1.c:179:3: note: call to ‘free’ here
  179 |   free((void *) indices);
      |   ^~~~~~~~~~~~~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants