qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 11/14] nbd/client: Add nbd_receive_export_list()


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-devel] [PATCH 11/14] nbd/client: Add nbd_receive_export_list()
Date: Fri, 7 Dec 2018 10:07:36 +0000

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

[Prev in Thread] Current Thread [Next in Thread]