[libvirt] [PATCH 7/n] qemu: plug memory leak

Matthias Bolte matthias.bolte at googlemail.com
Wed Dec 1 16:44:51 UTC 2010


2010/11/30 Eric Blake <eblake at redhat.com>:
> * 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 leak triggers on every start/stop of a qemu domain, although
> it typically accounts for less than 1k leak per sequence.
>

> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index f00d8a3..faab42a 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -2068,10 +2068,9 @@ qemudShutdown(void) {
>
>     virSysinfoDefFree(qemu_driver->hostsysinfo);
>
> -    VIR_FREE(qemu_driver->securityDriverName);
> -    VIR_FREE(qemu_driver->logDir);
>     VIR_FREE(qemu_driver->configDir);
>     VIR_FREE(qemu_driver->autostartDir);
> +    VIR_FREE(qemu_driver->logDir);
>     VIR_FREE(qemu_driver->stateDir);
>     VIR_FREE(qemu_driver->libDir);
>     VIR_FREE(qemu_driver->cacheDir);
> @@ -2081,10 +2080,18 @@ qemudShutdown(void) {
>     VIR_FREE(qemu_driver->vncListen);
>     VIR_FREE(qemu_driver->vncPassword);
>     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->hugepage_path);
>
> +    VIR_FREE(qemu_driver->securityDriverName);

Any specific reason for this empty line in this block of free calls?

> +    VIR_FREE(qemu_driver->saveImageFormat);
> +    VIR_FREE(qemu_driver->dumpImageFormat);
> +
> +    ebtablesContextFree(qemu_driver->ebtables);
> +
>     if (qemu_driver->cgroupDeviceACL) {
>         for (i = 0 ; qemu_driver->cgroupDeviceACL[i] != NULL ; i++)
>             VIR_FREE(qemu_driver->cgroupDeviceACL[i]);

ACK.

Matthias




More information about the libvir-list mailing list