summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2010-09-14 08:35:47 -0700
committerNathan Kinder <nkinder@redhat.com>2010-09-15 09:11:05 -0700
commitff41170172f721a651eb3e00f676b7228f611b9d (patch)
tree09e1756930c7c224451a3a5fdbd3665d2ed2a0ce
parent3571d7a5855cb1c222f83f98e03c340185e43152 (diff)
downloadds-ff41170172f721a651eb3e00f676b7228f611b9d.tar.gz
ds-ff41170172f721a651eb3e00f676b7228f611b9d.tar.xz
ds-ff41170172f721a651eb3e00f676b7228f611b9d.zip
Bug 630097 - (cov#12148) NULL dereference in ruvInit()
We need to check if ruv is NULL before dereferencing it. The assertion will not help us here in an optimized build, so an explicit NULL check will keep us from crashing.
-rw-r--r--ldap/servers/plugins/replication/repl5_ruv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c
index 78f7a53b..d2917ac8 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.c
+++ b/ldap/servers/plugins/replication/repl5_ruv.c
@@ -1443,6 +1443,10 @@ ruvInit (RUV **ruv, int initCount)
{
PR_ASSERT (ruv);
+ if (ruv == NULL) {
+ return RUV_NSPR_ERROR;
+ }
+
/* allocate new RUV */
*ruv = (RUV *)slapi_ch_calloc (1, sizeof (RUV));
@@ -1457,9 +1461,7 @@ ruvInit (RUV **ruv, int initCount)
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"ruvInit: failed to create lock\n");
- if (*ruv) {
- dl_free(&(*ruv)->elements);
- }
+ dl_free(&(*ruv)->elements);
slapi_ch_free((void**)ruv);
return RUV_NSPR_ERROR;
}