Преглед изворни кода

Trac Ticket #359 - Database RUV could mismatch the one in changelog under the stress

https://fedorahosted.org/389/ticket/359

Fix Description:
. Fix for csnplRollUp - was leaking the node data - since
llistRemoveCurrentAndGetNext will detach the current node,
we have to free the data associated with the current node
first, but not the csn, so set that to NULL first
Reviewed by: nhosoi (Thanks!)
Rich Megginson пре 13 година
родитељ
комит
12567ffd8c
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      ldap/servers/plugins/replication/csnpl.c

+ 5 - 2
ldap/servers/plugins/replication/csnpl.c

@@ -101,9 +101,8 @@ CSNPL* csnplNew ()
 
 
 void
-csnpldata_free(void **data)
+csnpldata_free(csnpldata **data_to_free)
 {
-	csnpldata **data_to_free = (csnpldata **)data;
 	if (NULL != data_to_free)
 	{
 		if (NULL != (*data_to_free)->csn)
@@ -319,6 +318,10 @@ csnplRollUp(CSNPL *csnpl, CSN **first_commited)
 				*first_commited = data->csn;
 				freeit = PR_FALSE;
 			}
+			/* llistRemoveCurrentAndGetNext will detach the current node
+			   so we have to free the data associated with it, but not the csn */
+			data->csn = NULL;
+			csnpldata_free(&data);
 			data = (csnpldata *)llistRemoveCurrentAndGetNext(csnpl->csnList, &iterator);
 		} else {
 			data = (csnpldata *)llistGetNext (csnpl->csnList, &iterator);