From 5e92c981b0e433ee28b953d222a1b531b525ff1c Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: Tue, 16 Jun 2015 11:14:37 +0200 Subject: [PATCH] fix coverity issues Reviewed-By: Martin Basti --- 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 9851df059..a56704f51 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);