ldap/servers/plugins/replication/repl5_agmt.c | 6 +++---
ldap/servers/plugins/replication/repl5_replica.c | 8 ++++++--
2 files changed, 9 insertions(+), 5 deletions(-)
New commits:
commit 8d398a555fc1632d678223e6547a5a4df4082775
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Nov 4 09:52:11 2013 -0500
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: rmeggins(Thanks!)
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--;
+ }
}