[PATCH 23/36] datatypes: convert virStorageVol to GObject

Jonathon Jongsma jjongsma at redhat.com
Wed Apr 8 21:57:37 UTC 2020


On Fri, 2020-04-03 at 17:15 +0200, Rafael Fonseca wrote:
> --- a/src/conf/virstorageobj.c
> +++ b/src/conf/virstorageobj.c
> @@ -1052,7 +1052,13 @@
> virStoragePoolObjVolumeListExport(virConnectPtr conn,
>      return data.nvols;
>  
>   error:
> -    virObjectListFree(data.vols);
> +    if (data.vols) {
> +        while (data.nvols--) {
> +            if (data.vols[data.nvols])
> +                g_object_unref(data.vols[data.nvols]);
> +        }
> +        VIR_FREE(data.vols);
> +    }
>      return -1;
>  }
>  

This pattern has been repeated several times now. Is it worth adding a
helper function that's equivalent to virObjectListFree but for
GObjects?




More information about the libvir-list mailing list