[libvirt PATCH 4/4] vbox: use g_new0 instead of VIR_ALLOC

Erik Skultety eskultet at redhat.com
Mon Oct 5 10:14:53 UTC 2020


On Mon, Oct 05, 2020 at 12:22:26AM +0200, Ján Tomko wrote:
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
...

>  
>      for (i = 0; i < sharedFolders.count; i++) {
>          ISharedFolder *sharedFolder = sharedFolders.items[i];
> @@ -3798,10 +3789,8 @@ vboxDumpAudio(virDomainDefPtr def, vboxDriverPtr data G_GNUC_UNUSED,
>              PRUint32 audioController = AudioControllerType_AC97;
>  
>              def->nsounds = 1;
> -            if (VIR_ALLOC_N(def->sounds, def->nsounds) < 0)
> -                return;
> -            if (VIR_ALLOC(def->sounds[0]) < 0)
> -                return;
> +            def->sounds = g_new0(virDomainSoundDefPtr, def->nsounds);

just use 1 for the counter and drop the nsounds attribute initialization
completely.

Reviewed-by: Erik Skultety <eskultet at redhat.com>




More information about the libvir-list mailing list