]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
prlsdkAddDomainVideoInfoCt: Remove pointless cleanup section
authorPeter Krempa <pkrempa@redhat.com>
Tue, 3 Aug 2021 13:05:59 +0000 (15:05 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 6 Aug 2021 06:53:26 +0000 (08:53 +0200)
'video' will only ever be NULL after the 'cleanup' label thus there's no
need to use 'virDomainVideoDefFree'. In fact we can fully remove the
cleanup section and 'ret' variable by returning directly from failure
points.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/vz/vz_sdk.c

index ef0905aaacc7f28d1df1f003e6107e4954ad6e10..26a3acb386a7667c4ea32934b2fcd8a6b4c1fa28 100644 (file)
@@ -542,24 +542,19 @@ prlsdkAddDomainVideoInfoCt(virDomainDef *def,
                            virDomainXMLOption *xmlopt)
 {
     virDomainVideoDef *video = NULL;
-    int ret = -1;
 
     if (def->ngraphics == 0)
         return 0;
 
     if (!(video = virDomainVideoDefNew(xmlopt)))
-        goto cleanup;
+        return -1;
 
     video->type = VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
     video->vram = 0;
 
     VIR_APPEND_ELEMENT(def->videos, def->nvideos, video);
 
-    ret = 0;
- cleanup:
-    virDomainVideoDefFree(video);
-
-    return ret;
+    return 0;
 }
 
 static int