Skip to content

Conversation

@buslov
Copy link

@buslov buslov commented Oct 30, 2017

I'm a member of the Pinguem.ru competition on finding errors in open source projects. A bug, found using PVS-Studio.

Warning:
Expression 'p1' is always true.

Expression 'p1' is always true.
@herrwiese
Copy link

Your code is semantically equivalent, but it doesn't fix the actual problem. The check tries to determine whether the contents of p1 are to be used (it fails to do that, indeed), so a better approach would be to replace malloc(sz) with calloc(sz, 1) and replace the tests like if (p1) with if (*p1).

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