Hi,
when running ASAN builds I noticed in some tests a memory leak for
dblayer perf counters.
A closer look showd it happens with an online restore, in this case we
have started dblayer in normal mode, then close it, but pass a mode to
prevent the cleanup of the perfcounters (this is according to a comment
intentionally), then we do the restore which will not touch the perf
counters and then start the dblayer again, in normal mode, which just
allocates new memory for the perf counters and overwrites the existing
ones, which will now be leaked.
So how to deal with it:
1] make behaviour as intended by the comment and fix it like:
diff --git a/ldap/servers/slapd/back-ldbm/perfctrs.c
b/ldap/servers/slapd/back-ldbm/perfctrs.c
index 57a8cbc84..c264a7eec 100644
--- a/ldap/servers/slapd/back-ldbm/perfctrs.c
+++ b/ldap/servers/slapd/back-ldbm/perfctrs.c
@@ -34,7 +34,10 @@ perfctrs_init(struct ldbminfo *li
__attribute__((unused)), perfctrs_private **re
{
perfctrs_private *priv = NULL;
- *ret_priv = NULL;
+ if(*ret_priv != NULL) {
+ /* we already have allocated perf counters, continue to use them */
+ return;
+ }
/*
* We need the perfctrs_private area on all platforms.
or 2]
keep the behaviour as it is now and cleanup the perf counters if closed
before RESTORE ?
Regards,
Ludwig