qemu: plug memory leak

* src/qemu/qemu_driver.c (qemudShutdown): Free all strings and the
ebtables structure.
* src/libvirt_private.syms (ebtablesContextFree): Export missing
symbol.
* src/util/ebtables.c (ebtablesContextFree): Allow early exit.
This commit is contained in:
Eric Blake 2010-11-30 09:00:30 -07:00
parent 6d0df64821
commit 428ea3a626
3 changed files with 12 additions and 3 deletions

View File

@ -326,6 +326,7 @@ virDomainConfVMNWFilterTeardown;
# ebtables.h # ebtables.h
ebtablesAddForwardAllowIn; ebtablesAddForwardAllowIn;
ebtablesAddForwardPolicyReject; ebtablesAddForwardPolicyReject;
ebtablesContextFree;
ebtablesContextNew; ebtablesContextNew;
ebtablesRemoveForwardAllowIn; ebtablesRemoveForwardAllowIn;

View File

@ -2069,10 +2069,9 @@ qemudShutdown(void) {
virSysinfoDefFree(qemu_driver->hostsysinfo); virSysinfoDefFree(qemu_driver->hostsysinfo);
VIR_FREE(qemu_driver->securityDriverName);
VIR_FREE(qemu_driver->logDir);
VIR_FREE(qemu_driver->configDir); VIR_FREE(qemu_driver->configDir);
VIR_FREE(qemu_driver->autostartDir); VIR_FREE(qemu_driver->autostartDir);
VIR_FREE(qemu_driver->logDir);
VIR_FREE(qemu_driver->stateDir); VIR_FREE(qemu_driver->stateDir);
VIR_FREE(qemu_driver->libDir); VIR_FREE(qemu_driver->libDir);
VIR_FREE(qemu_driver->cacheDir); VIR_FREE(qemu_driver->cacheDir);
@ -2082,9 +2081,16 @@ qemudShutdown(void) {
VIR_FREE(qemu_driver->vncListen); VIR_FREE(qemu_driver->vncListen);
VIR_FREE(qemu_driver->vncPassword); VIR_FREE(qemu_driver->vncPassword);
VIR_FREE(qemu_driver->vncSASLdir); VIR_FREE(qemu_driver->vncSASLdir);
VIR_FREE(qemu_driver->saveImageFormat); VIR_FREE(qemu_driver->spiceTLSx509certdir);
VIR_FREE(qemu_driver->spiceListen);
VIR_FREE(qemu_driver->spicePassword);
VIR_FREE(qemu_driver->hugetlbfs_mount); VIR_FREE(qemu_driver->hugetlbfs_mount);
VIR_FREE(qemu_driver->hugepage_path); VIR_FREE(qemu_driver->hugepage_path);
VIR_FREE(qemu_driver->securityDriverName);
VIR_FREE(qemu_driver->saveImageFormat);
VIR_FREE(qemu_driver->dumpImageFormat);
ebtablesContextFree(qemu_driver->ebtables);
if (qemu_driver->cgroupDeviceACL) { if (qemu_driver->cgroupDeviceACL) {
for (i = 0 ; qemu_driver->cgroupDeviceACL[i] != NULL ; i++) for (i = 0 ; qemu_driver->cgroupDeviceACL[i] != NULL ; i++)

View File

@ -300,6 +300,8 @@ ebtablesContextNew(const char *driver)
void void
ebtablesContextFree(ebtablesContext *ctx) ebtablesContextFree(ebtablesContext *ctx)
{ {
if (!ctx)
return;
if (ctx->input_filter) if (ctx->input_filter)
ebtRulesFree(ctx->input_filter); ebtRulesFree(ctx->input_filter);
if (ctx->forward_filter) if (ctx->forward_filter)