There is this question which has one close vote and three down-votes. The only comments are
- The code is broken because it doesn't deallocate memory (and because it uses a global variable although that observation is incorrect).
- The code won't work in a concurrent context.
Looking at the policy expounded in Are code snippets with known memory leaks broken?, this should not be considered broken.
I can't even find a policy on concurrency, although it seems like it should be obvious that it should not be considered broken unless the code is intended for concurrent use. Not thread safe is a reviewable observation, not a bug in my opinion.
There is one thing about the question that is in fact off-topic:
Also I've not used free() all that much as I was never very good with it for some reason. I'd love advice on where to use free() and how.
That's asking for code to be written. But no one has explained that that is problematic to the asker. So instead of fixing that, the asker tried to fix the things from the comments. But now the question really does have bugs, because one of the fixes is incorrect (it checks the wrong value after a malloc
).
It's unclear to me how to fix this question now. Roll back the edit that introduced the bug and edit out the off-topic line?
I flagged the "comments" that are really answers. But I can't flag the down-votes.
I could answer the question. But which version? The original? Or the revised, more broken version?
don't see a comment about concurrency
I commented thus as an argument against a non-local "overflow", and removed the comment when the source no longer showed such. (I think it obvious that non-reentrant does not imply broken, let alone make a question not useful.) \$\endgroup\$