summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-07-06 12:14:20 -0500
committerNoriko Hosoi <nhosoi@redhat.com>2010-08-23 17:07:30 -0700
commit8dd19cc7e6d8d20a83a5fcc7f9db85aa89c996c3 (patch)
tree9458426e713cc1928f2f17e2f90e8352d6e9bf7d
parent11ddce5b98f70173ab2d437c1467e4e784ce6afa (diff)
downloadds-8dd19cc7e6d8d20a83a5fcc7f9db85aa89c996c3.tar.gz
ds-8dd19cc7e6d8d20a83a5fcc7f9db85aa89c996c3.tar.xz
ds-8dd19cc7e6d8d20a83a5fcc7f9db85aa89c996c3.zip
Bug 611790 - fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166
https://bugzilla.redhat.com/show_bug.cgi?id=611790 Resolves: bug 611790 Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166 Fix description: Catch possible NULL pointer in replica_new_from_entry() and _replica_configure_ruv().
-rw-r--r--ldap/servers/plugins/replication/repl5_replica.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 1b1af659..7ca8730f 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -179,6 +179,16 @@ replica_new_from_entry (Slapi_Entry *e, char *errortext, PRBool is_add_operation
r = (Replica *)slapi_ch_calloc(1, sizeof(Replica));
+ if (!r)
+ {
+ if (NULL != errortext)
+ {
+ PR_snprintf(errortext, SLAPI_DSE_RETURNTEXT_SIZE, "Out of memory");
+ }
+ rc = -1;
+ goto done;
+ }
+
if ((r->repl_lock = PR_NewLock()) == NULL)
{
if (NULL != errortext)
@@ -1873,6 +1883,12 @@ _replica_configure_ruv (Replica *r, PRBool isLocked)
/* read ruv state from the ruv tombstone entry */
pb = slapi_pblock_new();
+ if (!pb) {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "_replica_configure_ruv: Out of memory\n");
+ goto done;
+ }
+
attrs[0] = (char*)type_ruvElement;
attrs[1] = NULL;
slapi_search_internal_set_pb(