Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ASSERT_TRUE to check for nullptr. #543

Merged
merged 1 commit into from
Nov 5, 2020

Conversation

clalancette
Copy link
Contributor

clang static analysis reports this as a false positive for
a possible memory leak. This is incorrect, but the FAQ
for googletest also has this tidbit:

https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-does-googletest-support-expect_eqnull-ptr-and-assert_eqnull-ptr-but-not-expect_nenull-ptr-and-assert_nenull-ptr

Thus, just switch to ASSERT_TRUE for the check, which is
good enough and makes clang static analysis happier.

Signed-off-by: Chris Lalancette clalancette@openrobotics.org

clang static analysis reports this as a false positive for
a possible memory leak.  This is incorrect, but the FAQ
for googletest also has this tidbit:

https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-does-googletest-support-expect_eqnull-ptr-and-assert_eqnull-ptr-but-not-expect_nenull-ptr-and-assert_nenull-ptr

Thus, just switch to ASSERT_TRUE for the check, which is
good enough and makes clang static analysis happier.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette
Copy link
Contributor Author

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@clalancette clalancette merged commit 04b6e4b into master Nov 5, 2020
@delete-merged-branch delete-merged-branch bot deleted the clalancette/fix-test-nullptr-check branch November 5, 2020 16:45
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.

None yet

2 participants