andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame 0279-Ticket-47969-COS-memory-leak-when-rebuilding-the-cac.patch

dc8c34
From b886661e3593aaa0bf0a7f8e0bbb3c53dd5b1f0f Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Tue, 2 Dec 2014 13:38:06 -0500
dc8c34
Subject: [PATCH 279/305] Ticket 47969 - COS memory leak when rebuilding the
dc8c34
 cache
dc8c34
dc8c34
Bug Description:  When the COS cache is released, not all of the schema
dc8c34
                  objectclasses are freed.  So every time we rebuild the
dc8c34
                  COS cache we leak memory.
dc8c34
dc8c34
Fix Description:  After we free the schema attributes, the very first
dc8c34
                  attribute still needs to be freed.  It is not freed
dc8c34
                  initially because of the duplicate checking logic, so
dc8c34
                  it is now done after the loop.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47969
dc8c34
dc8c34
Reviewed by: nhosoi(Thanks!)
dc8c34
dc8c34
(cherry picked from commit d2dfda95c543f106443f898436151b00c68e4270)
dc8c34
(cherry picked from commit 2444e0c4362615c4c65ffceeeb30d9380fb61e49)
dc8c34
---
dc8c34
 ldap/servers/plugins/cos/cos_cache.c | 2 ++
dc8c34
 1 file changed, 2 insertions(+)
dc8c34
dc8c34
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
dc8c34
index 9c49c12..db34d15 100644
dc8c34
--- a/ldap/servers/plugins/cos/cos_cache.c
dc8c34
+++ b/ldap/servers/plugins/cos/cos_cache.c
dc8c34
@@ -1907,6 +1907,8 @@ static void cos_cache_del_schema(cosCache *pCache)
dc8c34
 			}
dc8c34
 		}
dc8c34
 	}
dc8c34
+	/* Finally, remove the first attribute's objectclass list */
dc8c34
+	cos_cache_del_attrval_list(&(pCache->ppAttrIndex[0]->pObjectclasses));
dc8c34
 
dc8c34
 	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_del_schema\n",0,0,0);
dc8c34
 }
dc8c34
-- 
dc8c34
1.9.3
dc8c34