From: Peter Krempa Date: Tue, 3 Aug 2021 13:05:59 +0000 (+0200) Subject: prlsdkAddDomainVideoInfoCt: Remove pointless cleanup section X-Git-Tag: v7.7.0-rc1~278 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a31864e60a5d1eb3a87a40e50d7765c0ded699b4;p=thirdparty%2Flibvirt.git prlsdkAddDomainVideoInfoCt: Remove pointless cleanup section '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 Reviewed-by: Michal Privoznik --- diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index ef0905aaac..26a3acb386 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