This patch addresses coverity issues 13290 and 13291
>From 830f1f5af9695e35cb0843f8919c8fc555d13308 Mon Sep 17 00:00:00 2001
From: Ludwig Krispenz <lkris...@redhat.com>
Date: Tue, 16 Jun 2015 11:14:37 +0200
Subject: [PATCH] fix coverity issues

---
 daemons/ipa-slapi-plugins/topology/topology_util.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/daemons/ipa-slapi-plugins/topology/topology_util.c b/daemons/ipa-slapi-plugins/topology/topology_util.c
index 9851df059dc3e79ea0ae48d094de79b84ecfb086..a56704f51a282ebaa6dd86b80c1602689550f40f 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_util.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_util.c
@@ -192,7 +192,11 @@ ipa_topo_util_get_replica_conf(char *repl_root)
     slapi_free_search_results_internal(pb);
     slapi_pblock_destroy(pb);
 
-    if (0 != ipa_topo_cfg_replica_add(topoRepl)) {
+    if (0 == topoRepl) {
+        slapi_log_error(SLAPI_LOG_FATAL, IPA_TOPO_PLUGIN_SUBSYSTEM,
+                        "ipa_topo_util_get_replica_conf: "
+                        "cannot create replica\n");
+    } else if (0 != ipa_topo_cfg_replica_add(topoRepl)) {
         slapi_log_error(SLAPI_LOG_FATAL, IPA_TOPO_PLUGIN_SUBSYSTEM,
                         "ipa_topo_util_get_replica_conf: "
                         "replica already exists\n");
@@ -1325,6 +1329,14 @@ ipa_topo_util_delete_segments_for_host(char *repl_root, char *delhost)
     TopoReplica *tconf = ipa_topo_cfg_replica_find(repl_root, 1);
     int check_reverse = 1;
 
+    if (NULL == tconf) {
+        slapi_log_error(SLAPI_LOG_PLUGIN, IPA_TOPO_PLUGIN_SUBSYSTEM,
+                            "ipa_topo_util_delete_segments_for_host: "
+                            "failed to get replica object for suffix: %s \n",
+                             repl_root);
+        return;
+    }
+
     /* first check if a segment originating at localhost exists */
     segm = ipa_topo_cfg_segment_find(repl_root, ipa_topo_get_plugin_hostname(),
                                      delhost, SEGMENT_LEFT_RIGHT);
-- 
2.1.0

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to