[libvirt] [PATCH] nwfilter: Fix memory leak on daemon init and shutdown

This patch fixes a memory leak on daemon init and shutdown. The module was initialized twice and not shut down. Signed-off-by: Stefan Berger <stefanb@us.ibm.com>

On Mon, Apr 12, 2010 at 07:56:47AM -0400, Stefan Berger wrote:
This patch fixes a memory leak on daemon init and shutdown. The module was initialized twice and not shut down.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
--- src/nwfilter/nwfilter_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Index: libvirt-acl/src/nwfilter/nwfilter_driver.c =================================================================== --- libvirt-acl.orig/src/nwfilter/nwfilter_driver.c +++ libvirt-acl/src/nwfilter/nwfilter_driver.c @@ -176,6 +176,8 @@ nwfilterDriverShutdown(void) { if (!driverState) return -1;
+ virNWFilterLearnShutdown(); + nwfilterDriverLock(driverState);
/* free inactive pools */ @@ -421,6 +423,5 @@ static virStateDriver stateDriver = { int nwfilterRegister(void) { virRegisterNWFilterDriver(&nwfilterDriver); virRegisterStateDriver(&stateDriver); - virNWFilterLearnInit(); return 0; }
ACK To fix the problem before the release that's fine, but I would prefer a second patch later where virNWFilterLearnInit() check if pendingLearnReq is non-NULL and return if this is already initialized. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Daniel Veillard <veillard@redhat.com> wrote on 04/12/2010 08:07:32 AM:
Please respond to veillard
On Mon, Apr 12, 2010 at 07:56:47AM -0400, Stefan Berger wrote:
This patch fixes a memory leak on daemon init and shutdown. The module was initialized twice and not shut down.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
--- src/nwfilter/nwfilter_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Index: libvirt-acl/src/nwfilter/nwfilter_driver.c =================================================================== --- libvirt-acl.orig/src/nwfilter/nwfilter_driver.c +++ libvirt-acl/src/nwfilter/nwfilter_driver.c @@ -176,6 +176,8 @@ nwfilterDriverShutdown(void) { if (!driverState) return -1;
+ virNWFilterLearnShutdown(); + nwfilterDriverLock(driverState);
/* free inactive pools */ @@ -421,6 +423,5 @@ static virStateDriver stateDriver = { int nwfilterRegister(void) { virRegisterNWFilterDriver(&nwfilterDriver); virRegisterStateDriver(&stateDriver); - virNWFilterLearnInit(); return 0; }
ACK
Pushed.
To fix the problem before the release that's fine, but I would prefer a second patch later where virNWFilterLearnInit() check if
pendingLearnReq
is non-NULL and return if this is already initialized.
I'll prepare a patch for that... Stefan
Daniel
-- Daniel Veillard | libxml Gnome XML XSLT toolkit
daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel Veillard
-
Stefan Berger