From 1808f317d5ef240fd0ac3947fcb90a895e46b436 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Mar 29 2019 18:59:05 +0000 Subject: Ticket 50308 - Revise memory leak fix Description; Turns out the previous commit did not address the changelog leak, and it introduced a compiler warning. This part of the fix is being reverted. https://pagure.io/389-ds-base/issue/50308 --- diff --git a/ldap/servers/plugins/replication/cl5_clcache.c b/ldap/servers/plugins/replication/cl5_clcache.c index 6c18829..6b591fb 100644 --- a/ldap/servers/plugins/replication/cl5_clcache.c +++ b/ldap/servers/plugins/replication/cl5_clcache.c @@ -547,6 +547,7 @@ clcache_refresh_consumer_maxcsns(CLC_Buffer *buf) int i; for (i = 0; i < buf->buf_num_cscbs; i++) { + csn_free(&buf->buf_cscbs[i]->consumer_maxcsn); ruv_get_largest_csn_for_replica( buf->buf_consumer_ruv, buf->buf_cscbs[i]->rid, @@ -589,7 +590,6 @@ clcache_refresh_local_maxcsn(const ruv_enum_data *rid_data, void *data) /* this is the first time we have a local change for the RID * we need to check what the consumer knows about it. */ - csn_free(&buf->buf_cscbs[i]->consumer_maxcsn); ruv_get_largest_csn_for_replica( buf->buf_consumer_ruv, buf->buf_cscbs[i]->rid, @@ -833,7 +833,6 @@ clcache_skip_change(CLC_Buffer *buf) /* Send CSNs that are covered by the local RUV snapshot */ if (csn_compare(buf->buf_current_csn, cscb->local_maxcsn) <= 0) { skip = 0; - csn_free(&cscb->consumer_maxcsn); csn_dup_or_init_by_csn(&cscb->consumer_maxcsn, buf->buf_current_csn); break; } @@ -848,8 +847,7 @@ clcache_skip_change(CLC_Buffer *buf) { csn_init_by_csn(cscb->local_maxcsn, buf->buf_current_csn); if (cscb->consumer_maxcsn) { - csn_free(&cscb->consumer_maxcsn); - csn_dup_or_init_by_csn(cscb->consumer_maxcsn, buf->buf_current_csn); + csn_init_by_csn(cscb->consumer_maxcsn, buf->buf_current_csn); } skip = 0; break;