Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

resolve several issues found by cppcheck #136

Merged
merged 2 commits into from
Aug 14, 2017
Merged

resolve several issues found by cppcheck #136

merged 2 commits into from
Aug 14, 2017

Conversation

chipitsine
Copy link
Contributor

[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.

[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.
@erthink erthink merged commit aa2dd22 into erthink:master Aug 14, 2017
@erthink
Copy link
Owner

erthink commented Aug 14, 2017

Thanks.
Should be noted, that a lot of suchlike was detected by Coverity (total 444 issues).
Most of is a false-positives, but requires API changes.
Therefore it is not yet fixed for now (will be in the 1.2 branch).

@@ -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 );
Copy link
Owner

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 );
Copy link
Owner

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.

@erthink
Copy link
Owner

erthink commented Aug 20, 2017

Invalid, should be reverted.
This is my mistake, related to #139


if ( ld == NULL ) return LDAP_PARAM_ERROR;

assert( LDAP_VALID( ld ) );
Copy link
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants