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 ldbm_back_modify().
Endi S. Dewata 15 years ago
parent
commit
fdd0c5f453
1 changed files with 8 additions and 3 deletions
  1. 8 3
      ldap/servers/slapd/back-ldbm/ldbm_modify.c

+ 8 - 3
ldap/servers/slapd/back-ldbm/ldbm_modify.c

@@ -221,7 +221,14 @@ ldbm_back_modify( Slapi_PBlock *pb )
 	slapi_pblock_get( pb, SLAPI_TARGET_ADDRESS, &addr );
 	slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
 	slapi_pblock_get( pb, SLAPI_PARENT_TXN, (void**)&parent_txn );
+
 	slapi_pblock_get( pb, SLAPI_OPERATION, &operation );
+	if (NULL == operation)
+	{
+		ldap_result_code = LDAP_OPERATIONS_ERROR;
+		goto error_return;
+	}
+
 	is_fixup_operation = operation_is_flag_set(operation, OP_FLAG_REPL_FIXUP);
 	is_ruv = operation_is_flag_set(operation, OP_FLAG_REPL_RUV);
 	inst = (ldbm_instance *) be->be_instance_info;
@@ -347,9 +354,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
 	 * before we make our last abandon check to avoid race conditions in
 	 * the code that processes abandon operations.
 	 */
-	if (operation) {
-		operation->o_status = SLAPI_OP_STATUS_WILL_COMPLETE;
-	}
+	operation->o_status = SLAPI_OP_STATUS_WILL_COMPLETE;
 	if ( slapi_op_abandoned( pb ) ) {
 		goto error_return;
 	}