summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-07-09 20:49:22 -0500
committerNoriko Hosoi <nhosoi@redhat.com>2010-08-20 11:53:39 -0700
commit9e6ba5ad02dbbe0a90b919583fae50924bffb31e (patch)
treefe296d82067cc4a15adc922dce16fb50ca24a7f4
parente164ed7f97f1960a1b5ae83634bb89a0f2c23a58 (diff)
downloadds-9e6ba5ad02dbbe0a90b919583fae50924bffb31e.tar.gz
ds-9e6ba5ad02dbbe0a90b919583fae50924bffb31e.tar.xz
ds-9e6ba5ad02dbbe0a90b919583fae50924bffb31e.zip
Bug 613056 - fix coverify Defect Type: Null pointer dereferences issues 11892 - 11939
https://bugzilla.redhat.com/show_bug.cgi?id=613056 Resolves: bug 613056 Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11892 - 11939 description: Catch possible NULL pointer in mapping_tree_entry_modify_callback() and mtn_remove_node().
-rw-r--r--ldap/servers/slapd/mapping_tree.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index 77a21bf4..eccfe4ea 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -1375,7 +1375,7 @@ int mapping_tree_entry_modify_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefor
int mapping_tree_entry_add_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg)
{
- mapping_tree_node *node;
+ mapping_tree_node *node = NULL;
int i;
backend * be;
@@ -1387,12 +1387,12 @@ int mapping_tree_entry_add_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore,
* be checked again
*/
*returncode = mapping_tree_entry_add(entryBefore, &node);
- if (LDAP_SUCCESS != *returncode)
+ if (LDAP_SUCCESS != *returncode || !node)
{
return SLAPI_DSE_CALLBACK_ERROR;
}
- if(node && node->mtn_parent != NULL && node != mapping_tree_root )
+ if(node->mtn_parent != NULL && node != mapping_tree_root )
{
/* If the node has a parent and the node is not the mapping tree root,
* then add it as a child node. Note that the special case when the
@@ -1433,7 +1433,7 @@ static void mtn_remove_node(mapping_tree_node * node)
PR_ASSERT(tmp_node != NULL);
- tmp_node->mtn_brother = node->mtn_brother;
+ if (tmp_node) tmp_node->mtn_brother = node->mtn_brother;
}
node->mtn_brother = NULL;
}