浏览代码

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 _cl5PositionCursorForReplay().
Endi S. Dewata 15 年之前
父节点
当前提交
684a89d7c5
共有 1 个文件被更改,包括 9 次插入4 次删除
  1. 9 4
      ldap/servers/plugins/replication/cl5_api.c

+ 9 - 4
ldap/servers/plugins/replication/cl5_api.c

@@ -5860,13 +5860,13 @@ static int _cl5PositionCursorForReplay (ReplicaId consumerRID, const RUV *consum
         {
         {
             /* use the supplier min csn for the buffer start csn - we know
             /* use the supplier min csn for the buffer start csn - we know
                this csn is in our changelog */
                this csn is in our changelog */
-            slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, 
-                            "%s: CSN %s not found and no purging, probably a reinit\n",
-                            agmt_name, csnStr);
             if ((RUV_SUCCESS == ruv_get_min_csn(supplierRuv, &startCSN)) &&
             if ((RUV_SUCCESS == ruv_get_min_csn(supplierRuv, &startCSN)) &&
                 startCSN)
                 startCSN)
             { /* must now free startCSN */
             { /* must now free startCSN */
                 csn_as_string(startCSN, PR_FALSE, csnStr); 
                 csn_as_string(startCSN, PR_FALSE, csnStr); 
+                slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, 
+                                "%s: CSN %s not found and no purging, probably a reinit\n",
+                                agmt_name, csnStr);
                 slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, 
                 slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, 
                                 "%s: Will try to use supplier min CSN %s to load changelog\n",
                                 "%s: Will try to use supplier min CSN %s to load changelog\n",
                                 agmt_name, csnStr);
                                 agmt_name, csnStr);
@@ -5874,9 +5874,14 @@ static int _cl5PositionCursorForReplay (ReplicaId consumerRID, const RUV *consum
             }
             }
             else
             else
             {
             {
-                slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, 
+                slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
+                                "%s: CSN %s not found and no purging, probably a reinit\n",
+                                agmt_name, csnStr);
+                slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl, 
                                 "%s: Could not get the min csn from the supplier RUV\n",
                                 "%s: Could not get the min csn from the supplier RUV\n",
                                 agmt_name);
                                 agmt_name);
+                rc = CL5_RUV_ERROR;
+                goto done;
             }
             }
         }
         }