[PATCH 09/23] prlsdkAddDomainVideoInfoCt: Remove pointless cleanup section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'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@xxxxxxxxxx>
---
 src/vz/vz_sdk.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 1cc9eb8caf..4f0aae91a2 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -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
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux