[libvirt] [PATCH 1/5] write pid file into stateDir

David Lutterkort lutter at redhat.com
Fri Dec 12 19:35:03 UTC 2008


On Fri, 2008-12-12 at 19:26 +0100, Guido Günther wrote:
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index ca96223..a2e573e 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -220,6 +220,10 @@ qemudStartup(void) {
>  
>          if ((base = strdup (SYSCONF_DIR "/libvirt")) == NULL)
>              goto out_of_memory;
> +
> +        if (asprintf (&qemu_driver->stateDir,
> +                      "%s/run/libvirt/qemu/", LOCAL_STATE_DIR) == -1)
> +            goto out_of_memory;

You need to explicitly set qemu_driver->stateDir to NULL if asprintf
fails, since it leaves the pointer in an undefined state.

> +
> +        if (asprintf (&qemu_driver->stateDir,
> +                      "%s/run/libvirt/qemu/", base) == -1)
> +            goto out_of_memory;
> +    }

Same here

David





More information about the libvir-list mailing list