Skip to content
Permalink
Browse files
Fix leak of providers in replication
Let's call wsrep_unload when necessary. Otherwise it is definitely leak.
That fixes #928
  • Loading branch information
klirichek committed Jun 26, 2019
1 parent a02aae0 commit ff476df955f057bd38e8b6ad6056325e9d6fbb9c
Showing with 11 additions and 9 deletions.
  1. +11 −9 src/searchdreplication.cpp
@@ -1295,19 +1295,17 @@ void ReplicationAbort()
// delete all clusters on daemon shutdown
void ReplicateClustersDelete()
{
wsrep_t * pProvider = nullptr;
void * pIt = nullptr;
while ( g_hClusters.IterateNext ( &pIt ) )
void* pIt = nullptr;
while ( g_hClusters.IterateNext ( &pIt ))
{
pProvider = g_hClusters.IterateGet ( &pIt )->m_pProvider;
auto * pCluster = g_hClusters.IterateGet ( &pIt );
auto* pCluster = SmallStringHash_T<ReplicationCluster_t *>::IterateGet ( &pIt );
auto pProvider = pCluster->m_pProvider;
ReplicateClusterDone ( pCluster );
SafeDelete( pCluster );
if ( pProvider )
wsrep_unload( pProvider );
}
g_hClusters.Reset();

if ( pProvider )
wsrep_unload ( pProvider );
g_hClusters.Reset ();
}

// clean up cluster prior to start it again
@@ -3439,9 +3437,13 @@ bool RemoteClusterDelete ( const CSphString & sCluster, CSphString & sError )
pCluster->m_dIndexHashes.Reset();
}

wsrep_t* pProvider = pCluster->m_pProvider;
ReplicateClusterDone ( pCluster );
SafeDelete ( pCluster );

if ( pProvider )
wsrep_unload ( pProvider );

return true;
}

0 comments on commit ff476df

Please sign in to comment.