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

Issue 4759 - Fix coverity issue (#4760)

Bug description:
	with #4218 (wtime, optime in access log), hrtime is set in the
	operation. But it is done before checking if the operation is
	set. covscan fails

Fix description:
	move the setting after verification that operation != NULL

relates: https://github.com/389ds/389-ds-base/issues/4759

Reviewed by: Simon Pichugin

Platforms tested: F34
tbordaz 4 жил өмнө
parent
commit
ad3e77d71d

+ 3 - 3
ldap/servers/slapd/extendop.c

@@ -279,9 +279,6 @@ do_extended(Slapi_PBlock *pb)
     slapi_pblock_get(pb, SLAPI_OPERATION, &pb_op);
     slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
 
-    /* Set the time we actually started the operation */
-    slapi_operation_set_time_started(pb_op);
-
     if (pb_conn == NULL || pb_op == NULL) {
         send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "param error", 0, NULL);
         slapi_log_err(SLAPI_LOG_ERR, "do_extended",
@@ -289,6 +286,9 @@ do_extended(Slapi_PBlock *pb)
         goto free_and_return;
     }
 
+    /* Set the time we actually started the operation */
+    slapi_operation_set_time_started(pb_op);
+
     /*
      * Parse the extended request. It looks like this:
      *

+ 3 - 3
ldap/servers/slapd/opshared.c

@@ -284,9 +284,6 @@ op_shared_search(Slapi_PBlock *pb, int send_result)
     slapi_pblock_get(pb, SLAPI_SEARCH_TARGET_SDN, &sdn);
     slapi_pblock_get(pb, SLAPI_OPERATION, &operation);
 
-    /* Set the time we actually started the operation */
-    slapi_operation_set_time_started(operation);
-
     if (NULL == sdn) {
         sdn = slapi_sdn_new_dn_byval(base);
         slapi_pblock_set(pb, SLAPI_SEARCH_TARGET_SDN, sdn);
@@ -317,6 +314,9 @@ op_shared_search(Slapi_PBlock *pb, int send_result)
         rc = -1;
         goto free_and_return_nolock;
     }
+    
+    /* Set the time we actually started the operation */
+    slapi_operation_set_time_started(operation);
 
     internal_op = operation_is_flag_set(operation, OP_FLAG_INTERNAL);
     flag_psearch = operation_is_flag_set(operation, OP_FLAG_PS);