Re: [PATCH v2 1/3] libxl: add support for multiple IP addresses

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

 



On Mon, Dec 11, 2017 at 07:58:54AM -0500, John Ferlan wrote:
> > +char *
> > +xenMakeIPList(virNetDevIPInfoPtr guestIP)
> > +{
> > +    size_t i;
> > +    char **address_array;
> > +    char *ret = NULL;
> > +
> > +    if (VIR_ALLOC_N(address_array, guestIP->nips + 1) < 0)
> > +        return NULL;
> > +
> > +    for (i = 0; i < guestIP->nips; i++) {
> > +        address_array[i] = virSocketAddrFormat(&guestIP->ips[i]->address);
> > +        if (!address_array[i])
> > +            goto cleanup;
> > +    }
> > +    address_array[guestIP->nips] = NULL;
> > +
> > +    ret = virStringListJoin((const char**)address_array, " ");
> > +
> > + cleanup:
> > +    while (i > 0)
> > +        VIR_FREE(address_array[--i]);
> 
> Coverity notes that address_array is leaked.  May I sugguest
> "virStringListFree()" on address array?

Then I should initialize each entry to NULL first (which will be
overridden a moment later). Is it ok?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux