mirror of https://github.com/wolfSSL/wolfssh.git
Coverity: Side effect in assertion
1. Modify AssertNotNull() to use the same pattern as AssertNull(). The macro assigns the pointer to a local variable and that is checked. Fixes CIDs: 537020 573008 573010 573011 573013 573014 573015 573016 573017 573018 573022 573023 573024pull/817/head
parent
dd377d6d53
commit
92cfb2e052
11
tests/api.c
11
tests/api.c
|
|
@ -85,12 +85,15 @@ char* myoptarg = NULL;
|
|||
|
||||
#define AssertTrue(x) Assert( (x), ("%s is true", #x), (#x " => FALSE"))
|
||||
#define AssertFalse(x) Assert(!(x), ("%s is false", #x), (#x " => TRUE"))
|
||||
#define AssertNotNull(x) Assert( (x), ("%s is not null", #x), (#x " => NULL"))
|
||||
|
||||
#define AssertNotNull(x) do { \
|
||||
PEDANTIC_EXTENSION void* _isNotNull = (void*)(x); \
|
||||
Assert(_isNotNull, ("%s is not null", #x), (#x " => NULL")); \
|
||||
} while (0)
|
||||
|
||||
#define AssertNull(x) do { \
|
||||
PEDANTIC_EXTENSION void* _x = (void*)(x); \
|
||||
\
|
||||
Assert(!_x, ("%s is null", #x), (#x " => %p", _x)); \
|
||||
PEDANTIC_EXTENSION void* _isNull = (void*)(x); \
|
||||
Assert(!_isNull, ("%s is null", #x), (#x " => %p", _isNull)); \
|
||||
} while(0)
|
||||
|
||||
#define AssertInt(x, y, op, er) do { \
|
||||
|
|
|
|||
Loading…
Reference in New Issue