-
Notifications
You must be signed in to change notification settings - Fork 30
resolve several issues found by cppcheck #136
Conversation
[servers/slapd/slapi/slapi_overlay.c:48] -> [servers/slapd/slapi/slapi_overlay.c:53]: (warning) Either the condition '(pb)!=NULL' is redundant or there is possible null pointer dereference: pb. [servers/slapd/slapi/slapi_overlay.c:49] -> [servers/slapd/slapi/slapi_overlay.c:53]: (warning) Either the condition '(pb)!=NULL' is redundant or there is possible null pointer dereference: pb. [servers/slapd/slapi/slapi_overlay.c:50] -> [servers/slapd/slapi/slapi_overlay.c:53]: (warning) Either the condition '(pb)!=NULL' is redundant or there is possible null pointer dereference: pb. [servers/slapd/slapi/slapi_overlay.c:51] -> [servers/slapd/slapi/slapi_overlay.c:53]: (warning) Either the condition '(pb)!=NULL' is redundant or there is possible null pointer dereference: pb. [libraries/libreldap/ntlm.c:104] -> [libraries/libreldap/ntlm.c:107]: (warning) Either the condition 'ld==NULL' is redundant or there is possible null pointer dereference: ld.
[libraries/libreldap/sortctrl.c:282] -> [libraries/libreldap/sortctrl.c:284]: (warning) Either the condition 'ld==NULL' is redundant or there is possible null pointer dereference: ld. [libraries/libreldap/sortctrl.c:399] -> [libraries/libreldap/sortctrl.c:401]: (warning) Either the condition 'ld==NULL' is redundant or there is possible null pointer dereference: ld. [libraries/libreldap/sortctrl.c:482] -> [libraries/libreldap/sortctrl.c:484]: (warning) Either the condition 'ld==NULL' is redundant or there is possible null pointer dereference: ld.
Thanks. |
@@ -45,13 +45,12 @@ slapi_over_pblock_new( Operation *op, SlapReply *rs ) | |||
Slapi_PBlock *pb; | |||
|
|||
pb = slapi_pblock_new(); | |||
PBLOCK_ASSERT_OP( pb, op->o_tag ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, this is wrong: assert(pb->pb_op != NULL);
if ( ld == NULL || res == NULL ) { | ||
return LDAP_PARAM_ERROR; | ||
} | ||
|
||
assert( ld != NULL ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This asserts should check precondition, but are useless after prev checks.
Invalid, should be reverted. |
|
||
if ( ld == NULL ) return LDAP_PARAM_ERROR; | ||
|
||
assert( LDAP_VALID( ld ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert is useless here.
[servers/slapd/slapi/slapi_overlay.c:48] -> [servers/slapd/slapi/slapi_overlay.c:53]: (warning) Either the condition '(pb)!=NULL' is redundant or there is possible null pointer dereference: pb.
[servers/slapd/slapi/slapi_overlay.c:49] -> [servers/slapd/slapi/slapi_overlay.c:53]: (warning) Either the condition '(pb)!=NULL' is redundant or there is possible null pointer dereference: pb.
[servers/slapd/slapi/slapi_overlay.c:50] -> [servers/slapd/slapi/slapi_overlay.c:53]: (warning) Either the condition '(pb)!=NULL' is redundant or there is possible null pointer dereference: pb.
[servers/slapd/slapi/slapi_overlay.c:51] -> [servers/slapd/slapi/slapi_overlay.c:53]: (warning) Either the condition '(pb)!=NULL' is redundant or there is possible null pointer dereference: pb.
[libraries/libreldap/ntlm.c:104] -> [libraries/libreldap/ntlm.c:107]: (warning) Either the condition 'ld==NULL' is redundant or there is possible null pointer dereference: ld.