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:
Matthias Bolte 2011-04-30 12:23:31 +02:00
parent feecc9f395
commit 0e7c7b8b32
3 changed files with 14 additions and 1 deletions

View File

@ -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;
}

View File

@ -199,6 +199,8 @@ nwfilterDriverShutdown(void) {
if (!driverState)
return -1;
virNWFilterConfLayerShutdown();
virNWFilterTechDriversShutdown();
virNWFilterLearnShutdown();
nwfilterDriverLock(driverState);

View File

@ -873,7 +873,10 @@ virNWFilterLearnThreadsTerminate(bool allowNewThreads) {
* Shutdown of this layer
*/
void
virNWFilterLearnShutdown(void) {
virNWFilterLearnShutdown(void)
{
if (!pendingLearnReq)
return;
virNWFilterLearnThreadsTerminate(false);