andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From f3cc6db2fc9d04743cbeb147acc41ecdffbdfbf0 Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Wed, 3 Jun 2015 12:12:54 -0700
dc8c34
Subject: [PATCH 330/333] Ticket #48149 - ns-slapd double free or corruption
dc8c34
 crash
dc8c34
dc8c34
Description: coverity defect: 2. Defect type: FORWARD_NULL
dc8c34
If mempstat is issued while an online import is running, it'd crash
dc8c34
the server.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/48149
dc8c34
dc8c34
Reviewed by rmeggins@redhat.com (Thank you, Rich!!)
dc8c34
dc8c34
(cherry picked from commit 608fcdfcd792e351edfc12cf89c2c9c6fc2a56d0)
dc8c34
---
dc8c34
 ldap/servers/slapd/back-ldbm/dblayer.c | 10 ++++++----
dc8c34
 1 file changed, 6 insertions(+), 4 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
dc8c34
index 031523c..228fdea 100644
dc8c34
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
dc8c34
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
dc8c34
@@ -4769,22 +4769,24 @@ int dblayer_memp_stat_instance(ldbm_instance *inst, DB_MPOOL_STAT **gsp,
dc8c34
 {
dc8c34
     DB_ENV *env = NULL;
dc8c34
     dblayer_private *priv = NULL;
dc8c34
+    struct dblayer_private_env *dblayerenv;
dc8c34
     int rc;
dc8c34
 
dc8c34
     PR_ASSERT(NULL != inst);
dc8c34
 
dc8c34
     if (inst->import_env->dblayer_DB_ENV) {
dc8c34
-        env = inst->import_env->dblayer_DB_ENV;
dc8c34
+        dblayerenv = inst->import_env;
dc8c34
     } else {
dc8c34
         priv = (dblayer_private *)inst->inst_li->li_dblayer_private;
dc8c34
         PR_ASSERT(NULL != priv);
dc8c34
-        env = priv->dblayer_env->dblayer_DB_ENV;
dc8c34
+        dblayerenv = priv->dblayer_env;
dc8c34
     }
dc8c34
+    env = dblayerenv->dblayer_DB_ENV;
dc8c34
     PR_ASSERT(NULL != env);
dc8c34
 
dc8c34
-    slapi_rwlock_wrlock(priv->dblayer_env->dblayer_env_lock);
dc8c34
+    slapi_rwlock_wrlock(dblayerenv->dblayer_env_lock);
dc8c34
     rc = MEMP_STAT(env, gsp, fsp, 0, (void *)slapi_ch_malloc);
dc8c34
-    slapi_rwlock_unlock(priv->dblayer_env->dblayer_env_lock);
dc8c34
+    slapi_rwlock_unlock(dblayerenv->dblayer_env_lock);
dc8c34
     return rc;
dc8c34
 }
dc8c34
 
dc8c34
-- 
dc8c34
1.9.3
dc8c34