[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]