From nobody Mon Feb 9 06:00:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1606913053; cv=none; d=zohomail.com; s=zohoarc; b=apsnUQygURpqdQO6Bjvzv9mlmBjpp8k24glyg9IiJTITqRfLKtW9XkulEvmA25NDNIeyr5t5T6WMnjUsnlaRuSrX1WBXFvGDlnea+3M5YAGLCcNQMUwV8on3QAGXtT0HvO2LuZte0hc6UV5OEntQZTEZXWBdElCWInK6PcNfy9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606913053; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aUCFAo54tgLDfxIu6u2/ioC8+19SjX1BZWgk8pujALk=; b=ld7QEUJOngAcNOz9zhNe5BZ4GgcdM2anHYzm8Y/be19AQ0uGPkAcA20yDOa+6NKWcUeUpXdqAHNMuV1/Oz0nr8B5osqXahar+CmPyq/ytfd3NpO+Nu27W7Bvh/An1ktccIJ18G/HgFSBeZP3gJsC8/FSaXNkzQi9nwsKKaIay9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 16069130533551018.9094988571269; Wed, 2 Dec 2020 04:44:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-427-NSYfN1A8NS6J56cB31m8Bw-1; Wed, 02 Dec 2020 07:44:10 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62E3C100C612; Wed, 2 Dec 2020 12:44:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D51C5D6AC; Wed, 2 Dec 2020 12:44:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F41084E58E; Wed, 2 Dec 2020 12:44:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2ChQX4003675 for ; Wed, 2 Dec 2020 07:43:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id E3FCA60C0F; Wed, 2 Dec 2020 12:43:26 +0000 (UTC) Received: from fedora.redhat.com (ovpn-112-197.phx2.redhat.com [10.3.112.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6EB860BFA for ; Wed, 2 Dec 2020 12:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606913052; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aUCFAo54tgLDfxIu6u2/ioC8+19SjX1BZWgk8pujALk=; b=XAStlQz3mV/VMogc22ZrPx+0D+S/5TVZok4HzN+VBBDPqA7VoXif0cBZD58LwqhKXw4HtR C0ha0VU/z5cTpAyjpoUXvtqmkof++L4nsocJ6iCEuVecMeOkgA58j8C4qnE2z3rGfybDqw E+2LmOpEeLA6Pxdto9pxiumlVUPSTNs= X-MC-Unique: NSYfN1A8NS6J56cB31m8Bw-1 From: John Ferlan To: libvir-list@redhat.com Subject: [PATCH 2/7] util: Resolve resource leak in virExec error path Date: Wed, 2 Dec 2020 07:43:16 -0500 Message-Id: <20201202124321.765271-3-jferlan@redhat.com> In-Reply-To: <20201202124321.765271-1-jferlan@redhat.com> References: <20201202124321.765271-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" On error, the @pidfilefd was not released Found by Coverity Signed-off-by: John Ferlan --- src/util/vircommand.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index e47dd6b932..1716225aeb 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -792,12 +792,14 @@ virExec(virCommandPtr cmd) if (virSetInherit(pidfilefd, true) < 0) { virReportSystemError(errno, "%s", _("Cannot disable close-on-exec flag")); + virPidFileReleasePath(cmd->pidfile, pidfilefd); goto fork_error; } =20 c =3D '1'; if (safewrite(pipesync[1], &c, sizeof(c)) !=3D sizeof(c)) { virReportSystemError(errno, "%s", _("Unable to notify child pr= ocess")); + virPidFileReleasePath(cmd->pidfile, pidfilefd); goto fork_error; } VIR_FORCE_CLOSE(pipesync[0]); --=20 2.28.0