Hi,
Is this a false positive or I'm doing something wrong?
#include <new> int main(int, char**) { auto* pNumber = new (std::nothrow) int; if (nullptr == pNumber) { return 1; } delete pNumber; pNumber = nullptr; return 0; }
Cppcheck produces
cppcheck_nothrow.cpp:5: warning (nullPointerRedundantCheck): Either the condition 'nullptr==pNumber' is redundant or there is possible null pointer dereference: new(std::nothrow)int.
Cppcheck 1.90 dev
Thank you, Igor
I do not see anything wrong here. Looks like a false positive. I will create a ticket for this issue.
Thanks for the report, i have now created a ticket: https://trac.cppcheck.net/ticket/9414
Great, thanks
Log in to post a comment.
Hi,
Is this a false positive or I'm doing something wrong?
Cppcheck produces
Cppcheck 1.90 dev
Thank you,
Igor
I do not see anything wrong here.
Looks like a false positive. I will create a ticket for this issue.
Thanks for the report, i have now created a ticket: https://trac.cppcheck.net/ticket/9414
Great, thanks