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

Re: [libvirt] [PATCH v3 26/34] Adapt to VIR_STRDUP and VIR_STRNDUP in src/vbox/*



On Fri, May 10, 2013 at 02:28:02PM +0200, Ján Tomko wrote:
> On 05/03/2013 04:53 PM, Michal Privoznik wrote:
> > ---
> >  src/vbox/vbox_XPCOMCGlue.c |   6 +-
> >  src/vbox/vbox_tmpl.c       | 278 +++++++++++++++++++--------------------------
> >  2 files changed, 117 insertions(+), 167 deletions(-)
> > 
> > diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
> > index 43ddac8..4ac7b91 100644
> > --- a/src/vbox/vbox_tmpl.c
> > +++ b/src/vbox/vbox_tmpl.c
> > @@ -2290,7 +2288,8 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
> >              def->virtType = VIR_DOMAIN_VIRT_VBOX;
> >              def->id = dom->id;
> >              memcpy(def->uuid, dom->uuid, VIR_UUID_BUFLEN);
> > -            def->name = strdup(dom->name);
> > +            if (VIR_STRDUP(def->name, dom->name) < 0)
> > +                goto cleanup;
> 
> Bailing out after one unsuccessful strdup? Other parts of this function don't
> share this defeatist attitude.

The VirtualBox code is truely awful in this respect. Any improvements
to reporting errors like this change does are more than welcome.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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