mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
nwfilter: Fix memory leak in the ebtables subdriver
Call shutdown functions for all subcomponents in nwfilterDriverShutdown. Make sure that this shutdown functions can safely be called multiple times and independent from the actual subcomponents state.
This commit is contained in:
parent
feecc9f395
commit
0e7c7b8b32
@ -125,6 +125,7 @@ struct int_map {
|
||||
* only one filter update allowed
|
||||
*/
|
||||
static virMutex updateMutex;
|
||||
static bool initialized = false;
|
||||
|
||||
void
|
||||
virNWFilterLockFilterUpdates(void) {
|
||||
@ -2971,6 +2972,8 @@ int virNWFilterConfLayerInit(virHashIterator domUpdateCB)
|
||||
{
|
||||
virNWFilterDomainFWUpdateCB = domUpdateCB;
|
||||
|
||||
initialized = true;
|
||||
|
||||
if (virMutexInitRecursive(&updateMutex))
|
||||
return 1;
|
||||
|
||||
@ -2980,7 +2983,12 @@ int virNWFilterConfLayerInit(virHashIterator domUpdateCB)
|
||||
|
||||
void virNWFilterConfLayerShutdown(void)
|
||||
{
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
virMutexDestroy(&updateMutex);
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -199,6 +199,8 @@ nwfilterDriverShutdown(void) {
|
||||
if (!driverState)
|
||||
return -1;
|
||||
|
||||
virNWFilterConfLayerShutdown();
|
||||
virNWFilterTechDriversShutdown();
|
||||
virNWFilterLearnShutdown();
|
||||
|
||||
nwfilterDriverLock(driverState);
|
||||
|
@ -873,7 +873,10 @@ virNWFilterLearnThreadsTerminate(bool allowNewThreads) {
|
||||
* Shutdown of this layer
|
||||
*/
|
||||
void
|
||||
virNWFilterLearnShutdown(void) {
|
||||
virNWFilterLearnShutdown(void)
|
||||
{
|
||||
if (!pendingLearnReq)
|
||||
return;
|
||||
|
||||
virNWFilterLearnThreadsTerminate(false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user