ldap/servers/slapd/back-ldbm/dblayer.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
New commits:
commit c17452dae0ddf2d7419c0d476e7c148516dc6aca
Author: Noriko Hosoi <nhosoi(a)jiji.usersys.redhat.com>
Date: Wed Aug 31 11:09:42 2011 -0700
Introducing an environment variable USE_VALGRIND to clean up the entry cache and dn
cache on exit.
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c
b/ldap/servers/slapd/back-ldbm/dblayer.c
index b3931a4..b158311 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -2589,16 +2589,19 @@ int dblayer_instance_close(backend *be)
if (NULL == inst)
return -1;
-#if defined(_USE_VALGRIND)
- /* When running a memory leak checking tool (e.g., valgrind),
- it reduces the noise by enabling this code. */
- LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s: Cleaning up entry cache\n",
- inst->inst_name);
- cache_clear(&inst->inst_cache, CACHE_TYPE_ENTRY);
- LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s: Cleaning up dn cache\n",
- inst->inst_name);
- cache_clear(&inst->inst_dncache, CACHE_TYPE_DN);
-#endif
+ if (getenv("USE_VALGRIND")) {
+ /*
+ * if any string is set to an environment variable USE_VALGRIND,
+ * when running a memory leak checking tool (e.g., valgrind),
+ * it reduces the noise by enabling this code.
+ */
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s: Cleaning up entry cache\n",
+ inst->inst_name);
+ cache_clear(&inst->inst_cache, CACHE_TYPE_ENTRY);
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s: Cleaning up dn cache\n",
+ inst->inst_name);
+ cache_clear(&inst->inst_dncache, CACHE_TYPE_DN);
+ }
if (attrcrypt_cleanup_private(inst)) {
LDAPDebug(LDAP_DEBUG_ANY,
Show replies by date