From: John Ferlan Date: Tue, 12 Dec 2017 13:33:48 +0000 (-0500) Subject: util: Fix error path in virSCSIVHostOpenVhostSCSI X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9e030093f20d6e5a70272af8e3826823de24f73a;p=libvirt.git util: Fix error path in virSCSIVHostOpenVhostSCSI We cannot be sure someone initialized the passed *vhostfd and we certainly don't want or need to be calling VIR_FORCE_CLOSE on what probably is -1. So let's just return -1 immediately. --- diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c index dc7df757a1..d6fbf5ed5b 100644 --- a/src/util/virscsivhost.c +++ b/src/util/virscsivhost.c @@ -87,7 +87,7 @@ int virSCSIVHostOpenVhostSCSI(int *vhostfd) { if (!virFileExists(VHOST_SCSI_DEVICE)) - goto error; + return -1; *vhostfd = open(VHOST_SCSI_DEVICE, O_RDWR);