01.12.2018 1:03, Eric Blake wrote:
> +/* Clean up result of nbd_receive_export_list */
> +void nbd_free_export_list(NBDExportInfo *info, int count)
> +{
> +    int i, j;

personally, I'd prefer explicit

if (!info) {
     return;
}

here, it's more obvious, and info is unchanging, strange to check it in
a loop.

> +
> +    for (i = 0; info && i < count; i++) {
> +        free(info[i].name);
> +        free(info[i].description);
> +        for (j = 0; j < info[i].n_contexts; j++) {
> +            free(info[i].contexts[j]);
> +        }
> +        free(info[i].contexts);
> +    }
> +    free(info);
> +}


-- 
Best regards,
Vladimir

Reply via email to