[libvirt] [PATCH v2] Implement CPU topology support for QEMU driver

Jiri Denemark jdenemar at redhat.com
Mon Jan 18 10:16:03 UTC 2010


On Sun, Jan 17, 2010 at 12:57:12 +0000, Daniel P. Berrange wrote:
> > @@ -2112,8 +2148,13 @@ int qemudBuildCommandLine(virConnectPtr conn,
> >          ADD_ARG_LIT("-mem-path");
> >          ADD_ARG_LIT(driver->hugepage_path);
> >      }
> > +
> > +    if (!(smp = qemudBuildCommandLineSmp(conn, def, qemuCmdFlags)))
> > +        goto error;
> > +
> >      ADD_ARG_LIT("-smp");
> > -    ADD_ARG_LIT(vcpus);
> > +    ADD_ARG_LIT(smp);
> > +    VIR_FREE(smp);
> 
> 
> If you've got an allocated string, then just use 'ADD_ARG(smp)' and which
> avoids the strdup() that ADD_ARG_LIT does and avoids need for VIR_FREE
> too. Also you should move the qemudBuildCommandLineSmp() call to *after*
> the ADD_ARG_LIT("-smp") line, otherwise you can leak 'smp' on OOM handling
> in the ADD_ARG_LIT("-smp") call.
> 
> 
> ACK, if you make that minor memory handling fix before committing

Right. I don't think I have commit rights so I can either send a v3 or someone
else can change it when committing this patch...

Jirka




More information about the libvir-list mailing list