From nobody Wed Nov 27 15:42:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1698489718; cv=none; d=zohomail.com; s=zohoarc; b=PR4QwXyPleBmozZ3PAaqS1LOtUbnHs1Iech8VpxGIFg7XzLxeeGa36DhJck2iReKHy5oJ8JTRy9a73M/98YRcEoLGjF52wsl597CgOudeG4SH2cabVQlAHHmddBdAB49KEp011laa+1yg0OET/+6GbSO0A1rB9b4oqQnnTmg888= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698489718; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7CFsfj+V7ArZMzvtMSrBkmxzQkTGIb36bEletW4AhPo=; b=Vp90bJgUb5auS/aUT09SJY0Iqb4Krw7KV9nnnF8d0lB6/Gqf27Tr3eOQGpgD0WkJTj1ylo+2ayuIl3hIPWfY/SWdOj08WmodYC6wdodyDdMA7X5R70TpOFQUHxmZtNIUA7uv0xe6z5MQ3roNmtwkt8jBom3D6MztBShjaXijMy0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1698489718711402.7237890216694; Sat, 28 Oct 2023 03:41:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwgkk-0003eX-C0; Sat, 28 Oct 2023 06:41:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qwgki-0003cB-8v for qemu-devel@nongnu.org; Sat, 28 Oct 2023 06:41:12 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qwgkg-00057p-MO for qemu-devel@nongnu.org; Sat, 28 Oct 2023 06:41:11 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-408382da7f0so21539655e9.0 for ; Sat, 28 Oct 2023 03:41:09 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id j7-20020a05600c1c0700b003fefb94ccc9sm3752213wms.11.2023.10.28.03.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 03:41:08 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A74A25F839; Sat, 28 Oct 2023 11:33:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698489669; x=1699094469; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7CFsfj+V7ArZMzvtMSrBkmxzQkTGIb36bEletW4AhPo=; b=VALZNGwsqUvf9PLGZ+SQAblV4T/mnAd6d4Kk0Jr3eT2uv8ZUls9qjl1sIw6UWOck8U Bw1o/BlDrXtC+tlLg4kcLP5hq2AHaeBNVjvx+xV75vCxbaoc3/2uPkw7q6NVRplca72q d8R1wwqBKZgCLFmOd61vr9pkkGKyZvxIk1Itmk9o+u5OYcOFcwHLNt+PDRmri8rzW7n5 9YbucKN8VCSXsv49LtFPG7q9YQ453mW0GJGnoAckdTqpCsbwTL8dx6dYSXXPMTr9Ue9S zzWEOo0NjY1mkRzEZS8oPQb7TZbU4sD5dTU75u8VOgW50EtP3P2zlj8bMEi1uxr9fEIK MUVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698489669; x=1699094469; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7CFsfj+V7ArZMzvtMSrBkmxzQkTGIb36bEletW4AhPo=; b=H1VyEaTUvOr+cRhHIukX08ReLX+uCh17gbo8T7JneV3wUP9cLVRnET0eJ22BwyQPdP Bgth6aGy+9vNeCTeKj/MBsvfp3C1Uxrcp22zABpULEM/39DvLujMpCx9IE4pgIarSJ+d lxqEDwI2rskRE5291u5Be16Fyo+jcGmM0Hqg0bZwIkDCul276HtzhL1UmSRoRqLqFxRp GKBJLunNkgDYTqDf3bfLDS/crysdJRI/ceZIFZ3l4ddH0juEiklZ9NLPfh4Fm8EAFes/ HBVXWvdAiu0rTAa1HA4InAS8PKc87ih4O4P+ybkaFIkZ7vgan5DKsLFVnGO3gQWbJ9ry VkXg== X-Gm-Message-State: AOJu0YwDk7K77GhpdHDUKHhWQRTGDR2HC3w2MKw6K5oBacus7oAwut2N 3gWQP8qya/gTzGTrU5kivVY6LQ== X-Google-Smtp-Source: AGHT+IGc1gBbFYvddSNkbfN6IG72wUPWquV1/pLl8iHTHmnXUXaq5/7jgFeKefqoWvC9Huppwk3Kgg== X-Received: by 2002:a05:600c:d6:b0:3fe:1232:93fa with SMTP id u22-20020a05600c00d600b003fe123293famr4115956wmm.22.1698489668805; Sat, 28 Oct 2023 03:41:08 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Mahmoud Mandour , Brian Cain , Paolo Bonzini , Warner Losh , Eduardo Habkost , Alexandre Iooss , "Edgar E. Iglesias" , Kyle Evans , qemu-arm@nongnu.org, Aleksandar Rikalo , Aurelien Jarno , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Wainer dos Santos Moschetta , Peter Maydell , Brad Smith , Jiaxun Yang , Thomas Huth , Cong Liu Subject: [PATCH 17/17] contrib/plugins: Close file descriptor on error return Date: Sat, 28 Oct 2023 11:33:11 +0100 Message-Id: <20231028103311.347104-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231028103311.347104-1-alex.bennee@linaro.org> References: <20231028103311.347104-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1698489719263100001 From: Cong Liu This patch closes the file descriptor fd on error return to avoid resource leak. Fixes: ec7ee95db909 ("contrib/plugins: fix coverity warning in lockstep") Signed-off-by: Cong Liu Message-Id: <20231018025225.1640122-1-liucong2@kylinos.cn> Signed-off-by: Alex Benn=C3=A9e --- contrib/plugins/lockstep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c index f0cb8792c6..237543b43a 100644 --- a/contrib/plugins/lockstep.c +++ b/contrib/plugins/lockstep.c @@ -257,6 +257,7 @@ static bool setup_socket(const char *path) sockaddr.sun_family =3D AF_UNIX; if (g_strlcpy(sockaddr.sun_path, path, pathlen) >=3D pathlen) { perror("bad path"); + close(fd); return false; } =20 @@ -303,6 +304,7 @@ static bool connect_socket(const char *path) sockaddr.sun_family =3D AF_UNIX; if (g_strlcpy(sockaddr.sun_path, path, pathlen) >=3D pathlen) { perror("bad path"); + close(fd); return false; } =20 --=20 2.39.2