[libvirt] [PATCH 12/15] test: Use VIR_AUTOFREE for test driver

Erik Skultety eskultet at redhat.com
Thu Feb 7 15:00:55 UTC 2019


On Wed, Feb 06, 2019 at 08:41:44AM -0500, John Ferlan wrote:
> Let's make use of the auto __cleanup capabilities cleaning up any
> now unnecessary goto paths.
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
...

>
> @@ -6342,7 +6302,7 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
>      virDomainSnapshotObjPtr snap = NULL;
>      virDomainSnapshotPtr snapshot = NULL;
>      virObjectEventPtr event = NULL;
> -    char *xml = NULL;
> +    VIR_AUTOFREE(char *) xml = NULL;

@xml will become unused in this function with this conversion, so I'd say cook
up a trivial patch that will get rid of it as unused.

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

>      bool update_current = true;
>      bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE;
>      unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
> @@ -6427,7 +6387,6 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
>
>      snapshot = virGetDomainSnapshot(domain, snap->def->name);
>   cleanup:
> -    VIR_FREE(xml);
>      if (vm) {
>          if (snapshot) {
>              virDomainSnapshotObjPtr other;




More information about the libvir-list mailing list