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?