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

Guido Günther agx at sigxcpu.org
Fri Dec 12 22:26:02 UTC 2008


On Fri, Dec 12, 2008 at 11:35:03AM -0800, David Lutterkort wrote:
> 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
Done via virAsprintf. Thanks for pointing this out.
 -- Guido




More information about the libvir-list mailing list