From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9489DA04DB; Thu, 15 Oct 2020 19:02:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E0A7B1DC4C; Thu, 15 Oct 2020 19:02:40 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id D30721DC14 for ; Thu, 15 Oct 2020 19:02:39 +0200 (CEST) IronPort-SDR: u4rjLCoFKd13YrXrw73RGAEO6IH2BRcmePF/9SLf8WK+pYvDXY5y5tOrkOetZt7JQhU6OVV1rx WI25jeHTlOfA== X-IronPort-AV: E=McAfee;i="6000,8403,9775"; a="146260722" X-IronPort-AV: E=Sophos;i="5.77,379,1596524400"; d="scan'208";a="146260722" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2020 10:02:37 -0700 IronPort-SDR: y0yYQf2pqYSIaPwaQRsBrLHj2YHxqCBJ8J0VBRXWv8Gg5q37/9eyYOrXcgX9RiUuW4XC5pbdZG Me19BDGwNscQ== X-IronPort-AV: E=Sophos;i="5.77,379,1596524400"; d="scan'208";a="346192265" Received: from klaatz-mobl1.ger.corp.intel.com (HELO [10.213.213.234]) ([10.213.213.234]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2020 10:02:37 -0700 To: Ciara Power , dev@dpdk.org References: <20201013155648.3471-1-ciara.power@intel.com> From: Kevin Laatz Message-ID: <7d320cfb-a211-69cd-dbff-68fe8b7f7ad0@intel.com> Date: Thu, 15 Oct 2020 18:02:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20201013155648.3471-1-ciara.power@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [dpdk-dev] [PATCH] test/telemetry: fix socket resource leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 13/10/2020 16:56, Ciara Power wrote: > If an error occurred when reading from the socket, the function > returned without closing the socket. This is now fixed to avoid the > resource leak of the sock variable going out of scope. > > Fixes: bd78cf693ebd ("test/telemetry: add unit tests for data to JSON") > Coverity issue: 363043 > > Signed-off-by: Ciara Power > --- > app/test/test_telemetry_data.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c > index 7a31e68a78..f3807a7255 100644 > --- a/app/test/test_telemetry_data.c > +++ b/app/test/test_telemetry_data.c > @@ -327,6 +327,7 @@ connect_to_socket(void) > if (bytes < 0) { > printf("%s: Error with socket read - %s\n", __func__, > strerror(errno)); > + close(sock); > return -1; > } > buf[bytes] = '\0'; Acked-by: Kevin Laatz