From f6709337b56a60a446314ab37622ead929e72f65 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Mon, 4 Nov 2013 09:52:11 -0500 Subject: [PATCH] Ticket 47368 - Fix coverity issues CID 12376 (#1 of 1): Explicit null dereferenced (FORWARD_NULL) CID 12377 (#1 of 1): Uninitialized pointer read (UNINIT) https://fedorahosted.org/389/ticket/47368 Reviewed by:? --- ldap/servers/plugins/replication/repl5_agmt.c | 6 +++--- ldap/servers/plugins/replication/repl5_replica.c | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ldap/servers/plugins/replication/repl5_agmt.c b/ldap/servers/plugins/replication/repl5_agmt.c index e57c2f4..c78ee94 100644 --- a/ldap/servers/plugins/replication/repl5_agmt.c +++ b/ldap/servers/plugins/replication/repl5_agmt.c @@ -2929,14 +2929,14 @@ done: /* * Parse out the consumer replicaID from the agmt maxcsn * - * "repl area;agmt rdn;hostname;port;consumer rid;maxcsn" + * "repl area;agmt_rdn;hostname;port;consumer_rid;maxcsn" */ static ReplicaId agmt_maxcsn_get_rid(char *maxcsn) { ReplicaId rid = 0; char *token = NULL; - char *iter; + char *iter = NULL; char *value = slapi_ch_strdup(maxcsn); token = ldap_utf8strtok_r(value, ";", &iter); /* repl area */ @@ -2945,7 +2945,7 @@ agmt_maxcsn_get_rid(char *maxcsn) token = ldap_utf8strtok_r(iter, ";", &iter); /* port */ token = ldap_utf8strtok_r(iter, ";", &iter); /* rid */ - if(strcmp(token, "Unavailable")){ + if(token && strcmp(token, "Unavailable")){ rid = atoi(token); } slapi_ch_free_string(&value); diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c index d28b48c..ec5bf4d 100644 --- a/ldap/servers/plugins/replication/repl5_replica.c +++ b/ldap/servers/plugins/replication/repl5_replica.c @@ -3947,11 +3947,15 @@ replica_get_agmt_count(Replica *r) void replica_incr_agmt_count(Replica *r) { - r->agmt_count++; + if(r){ + r->agmt_count++; + } } void replica_decr_agmt_count(Replica *r) { - r->agmt_count--; + if(r){ + r->agmt_count--; + } } -- 1.7.1