[libvirt] [PATCH] init path to NULL

Matthias Bolte matthias.bolte at googlemail.com
Wed Apr 6 06:42:08 UTC 2011


2011/4/6 Wen Congyang <wency at cn.fujitsu.com>:
> This bug was introduce by commit 57162db8, and it will cause libvirtd crashed.
>
> ---
>  src/util/pci.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/util/pci.c b/src/util/pci.c
> index 6ed96f4..a7b8caa 100644
> --- a/src/util/pci.c
> +++ b/src/util/pci.c
> @@ -1180,7 +1180,7 @@ pciWaitForDeviceCleanup(pciDevice *dev, const char *matcher)
>  static char *
>  pciReadDeviceID(pciDevice *dev, const char *id_name)
>  {
> -    char *path;
> +    char *path = NULL;
>     char *id_str;
>
>     if (pciDeviceFile(&path, dev->name, id_name) < 0) {
> --
> 1.7.1
>

Oops... shows that I didn't tests this well enough :(

ACK.

Maybe you could make the commit summary more verbose, for example
"pci: avoid invalid free, init path to NULL".

Matthias




More information about the libvir-list mailing list