[PATCH 7/7] qemuMigrationCapsCheck: Refactor variable cleanup

Ján Tomko jtomko at redhat.com
Mon Aug 24 13:38:30 UTC 2020


On a Monday in 2020, Peter Krempa wrote:
>Use automatic memory allocation to simplify the code and remove the need
>for a 'cleanup:' label.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_migration_params.c | 33 ++++++++++++--------------------
> 1 file changed, 12 insertions(+), 21 deletions(-)
>
>diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
>index 38a5a91f2a..c785f87ab8 100644
>--- a/src/qemu/qemu_migration_params.c
>+++ b/src/qemu/qemu_migration_params.c
>@@ -1352,11 +1352,10 @@ qemuMigrationCapsCheck(virQEMUDriverPtr driver,
>                        int asyncJob)
> {
>     qemuDomainObjPrivatePtr priv = vm->privateData;
>-    virBitmapPtr migEvent = NULL;
>-    virJSONValuePtr json = NULL;
>-    char **caps = NULL;
>+    g_autoptr(virBitmap) migEvent = NULL;
>+    g_autoptr(virJSONValue) json = NULL;

>+    VIR_AUTOSTRINGLIST caps = NULL;

You can do:

     g_auto(GStrv) caps = NULL;

here.

Either way:
Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200824/8460ea73/attachment-0001.sig>


More information about the libvir-list mailing list