From patchwork Mon Nov 16 12:24:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 324374 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp3272721ils; Mon, 16 Nov 2020 04:24:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUC1adiCAk68077jF2IHLB0agg2+oaWbuLAmmdEsOR/zcV/wbld9ZBWJ3xeTC7G5Ha0hqj X-Received: by 2002:a25:2e41:: with SMTP id b1mr18277975ybn.384.1605529482347; Mon, 16 Nov 2020 04:24:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605529482; cv=none; d=google.com; s=arc-20160816; b=aM2nE4tSsV/Q6VinY5antu6ywWIuG6Qnyo4CoBxs3vBOCjvEI4ExPDScAfxyZBvFPe DP9/4No+l7mOYmIHi7ZhP4WF2o3i84o6IUAwOXZxZU+2hPYrkjhD7fQJ27JVF7D8rpzW qUNmyk2M7B2Z6EURnD9hl3R2Qowqur+rBJlqQZwy3shneeAmwtH/HUwi2WPsgOI4Hc7h OLkGr4PI/jsndkzeetIjn2WKWzJAyzAV/My1elP3gamjGGZdni/9CiUFcRoi5LkSarE6 xDzU+bj09tep2jpoZWeUG0rwZNWrfADBvyyIxYBYPbncKGFxcuX4nIikrGBouItF+0BU qIgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=vHv4EHcIqVjX/nk8AgqAMkp9FkP1WHOt6fzSvyu1HXc=; b=WMkklk3cc3LNRt5BOy6PrdmeXMJC26DJ/WvsExs1bSbjPZAk0Yxe5SOhWLeBIqFOzI iHsYEX3GsuHEH/yS0fFJJ5HZEJazb+m1R/n1tUC7bFWWGIV852NvoyTrPghypMWzGzFD Ni5TtSx7E9+lM5Fz/XauVEmOARHEQVtjRzrgmYKWduEBTATEtvlbiXjKkw8yZYW3RqLL N8PrgjOR59pe1WiVC8+FuJeqG1pk1GEFpsLyk22zmt1IJ4wZ76qnGmf68u2GsRZ7i/oq qxcu1VQ1chNfRaSNO7stnmWqXc2Y+lIYQUnN2z6m4O2JYhQtD1NRi6/TGYCoRjWX1hgX Ictw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cQEEMK3h; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u12si17507447ybm.271.2020.11.16.04.24.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Nov 2020 04:24:42 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cQEEMK3h; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kedYn-0001Vc-R5 for patch@linaro.org; Mon, 16 Nov 2020 07:24:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kedYX-0001Th-Tp for qemu-devel@nongnu.org; Mon, 16 Nov 2020 07:24:25 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:51103) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kedYW-00037o-8n for qemu-devel@nongnu.org; Mon, 16 Nov 2020 07:24:25 -0500 Received: by mail-wm1-x335.google.com with SMTP id h2so23567988wmm.0 for ; Mon, 16 Nov 2020 04:24:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vHv4EHcIqVjX/nk8AgqAMkp9FkP1WHOt6fzSvyu1HXc=; b=cQEEMK3h469kTNKn+cv+AOMt5eP0GBBv7ROtsjqyUby9+ebseIjkMAOT19cBFMgLQ/ p0rlk2EKbmjb61rpxVbl5Gweq8u3/m6Tzp/Ys1BPn24iiNR3ys23qPjqmHM8yGKGbWhx ac1GyJ+u5sHU4gHrjVSpS/1AgY8seaCgV5pjWv5txsRdRJ7esfwTzV2adHj2AJ7oAKdm d9w9gC2Z60TnfaDYaWUxt1yhCptvlW2c2+SFcFb+FwFjoJEo4LSteqcvemYXl7wZCPxL PoSlTr19wo6hMJTaMLsKKBCeApzqU8lNs2Z8jkZtsjZnbG1WaB37+6LfMbXlpu54h8LY K3Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vHv4EHcIqVjX/nk8AgqAMkp9FkP1WHOt6fzSvyu1HXc=; b=N7BDPitqUqJtPSLOPCI5ExBpSKQntojKAjvOs64RSBUS6XpJJgdYxC1Vjx+BnmbFyg COfU+zcp+PnWsp0dG0ZYJxq7HbQL9+jQS65uQGjzntea1itHIzlK1+p1pygKI4to7bPo xWMlfOlpNUFRYdCdWkEZINuq2QbOKP4DCE6rNhWXbdjpDmB9lcgHIUPd5E0l9jvxy4qM wMPHOsThkk8FDyE8+jwFgGNcziHyRTIAv/8j33PwcqGSROm/raPdIOQ7EqGbTDfuxuZZ Au0CBnb7KVO5tvk8rGYCi0I5ZMmPurZAOCqLiNsoyh20dOXvSnUoNHUphbByMObors23 ArRQ== X-Gm-Message-State: AOAM530z3VEpreI36jxAT9lsp0STQbQPYRHQVnIxehmRFyfA44TXe+ny 5xwIJJyETucj0P3+5mqzv1Ommw== X-Received: by 2002:a7b:c202:: with SMTP id x2mr14950568wmi.48.1605529460860; Mon, 16 Nov 2020 04:24:20 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t74sm20045679wmt.8.2020.11.16.04.24.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2020 04:24:18 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DF03F1FF87; Mon, 16 Nov 2020 12:24:17 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 1/9] plugins: Fix resource leak in connect_socket() Date: Mon, 16 Nov 2020 12:24:09 +0000 Message-Id: <20201116122417.28346-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201116122417.28346-1-alex.bennee@linaro.org> References: <20201116122417.28346-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Chen , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Euler Robot Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Chen Close the fd when the connect() fails. Reported-by: Euler Robot Signed-off-by: Alex Chen Signed-off-by: Alex Bennée Message-Id: <20201109082829.87496-2-alex.chen@huawei.com> Message-Id: <20201110192316.26397-2-alex.bennee@linaro.org> -- 2.20.1 diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c index a696673dff..319bd44b83 100644 --- a/contrib/plugins/lockstep.c +++ b/contrib/plugins/lockstep.c @@ -292,6 +292,7 @@ static bool connect_socket(const char *path) if (connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) { perror("failed to connect"); + close(fd); return false; }