Browse Source

Bug 610119 - fix coverify Defect Type: Null pointer dereferences issues 12167 - 12199

https://bugzilla.redhat.com/show_bug.cgi?id=610119
Resolves: bug 610119
Bug description: Fix coverify Defect Type: Null pointer dereferences issues 12167 - 12199
Fix description: Catch possible NULL pointer in slapi_check_account_lock().
Endi S. Dewata 15 years ago
parent
commit
c7546a1de1
1 changed files with 5 additions and 4 deletions
  1. 5 4
      ldap/servers/slapd/pw.c

+ 5 - 4
ldap/servers/slapd/pw.c

@@ -2018,7 +2018,7 @@ slapi_check_account_lock ( Slapi_PBlock *pb, Slapi_Entry * bind_target_entry, in
 								&type_name_disposition, &actual_type_name,
 								SLAPI_VIRTUALATTRS_REQUEST_POINTERS,
 								&attr_free_flags);
-	if ( rc == 0 )
+	if ( rc == 0 && NULL != values )
 	{
 		Slapi_Value *v = NULL;	
 		const struct berval *bvp = NULL;
@@ -2041,10 +2041,11 @@ slapi_check_account_lock ( Slapi_PBlock *pb, Slapi_Entry * bind_target_entry, in
 				goto locked;
 			}
 		} /* else, account "activated", keep on the process */
-
-		if ( values != NULL )
-			slapi_vattr_values_free(&values, &actual_type_name, attr_free_flags);
 	}
+
+	if ( values != NULL )
+		slapi_vattr_values_free(&values, &actual_type_name, attr_free_flags);
+
 	/* kexcoff - end */
 
 	/*