1
0
Эх сурвалжийг харах

Bug 614511 - fix coverify Defect Type: Null pointer dereferences issues 11846 - 11891

https://bugzilla.redhat.com/show_bug.cgi?id=614511
Resolves: bug 614511
Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11846 - 11891
description: Catch possible NULL pointer in cos_cache_query_attr().
Endi S. Dewata 15 жил өмнө
parent
commit
956dc04936

+ 4 - 5
ldap/servers/plugins/cos/cos_cache.c

@@ -2383,9 +2383,9 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context, Sl
 		}
 
 		/* is this entry a child of the target tree(s)? */
-		do
+		while(hit == 0 && pTargetTree)
 		{
-			if(pTargetTree) {
+			{
 				int rc = 0;
 				char *tval = NULL;
 				size_t tlen = 0;
@@ -2403,8 +2403,7 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context, Sl
 					pTargetTree->val = tval;
 				}
 			}
-
-    		if(	pTargetTree->val == 0 || 
+			if(	pTargetTree->val == 0 || 
 				slapi_dn_issuffix(pDn, pTargetTree->val) != 0 || 
 				(views_api && views_entry_exists(views_api, pTargetTree->val, e)) /* might be in a view */
 				)
@@ -2529,7 +2528,7 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context, Sl
 
 			pTargetTree = pTargetTree->list.pNext;
 
-		} while(hit == 0 && pTargetTree);
+		} /* while(hit == 0 && pTargetTree) */
 
 
 		if(hit==0 || merge_mode)