From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) by dpdk.org (Postfix) with ESMTP id 386ED2C5E for ; Thu, 3 Aug 2017 16:00:05 +0200 (CEST) Received: by mail-wr0-f177.google.com with SMTP id 12so6120795wrb.1 for ; Thu, 03 Aug 2017 07:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=qN5hpBrpO+T6Fj4d0iphsfWzeOx9EjAIfoHtW89OIMw=; b=O1eyDW/Wo+evzqTZ4uQikCKbuWgC8V3E7NyvhJMbkjwGIwKAFadmfeMjG3sYB9IW1T WfXc+X2gfL1L5X2oybhUdZjVoOYKNscMoYPyjwkKf4O+W+gXVXjwPPmpUUipJq7JL8Fr i3PvPCB5aZrYBQN8SPSFFq6w8cU3ngymJbEujd1etdo9tFbLcz7M3+CnJOsKnYt1Yzfi LIo5lr6KjECxLl6CjryiIDfssQeHu4TEG0LyWTk5tbOZv4Z8pZ0Y+cZevMooPU6ewFHU KPrnqdjr743tpGolYd3ceQdYmX5e4NT+OxBZq+uxPWD/0wQDgLehmW7TZOMYBbhhqVuh 4z8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=qN5hpBrpO+T6Fj4d0iphsfWzeOx9EjAIfoHtW89OIMw=; b=eLdfCDEa0eG3Gj5tbFcdEL7zywShAxWYBeyB+oGxA5cyzWNyQr2BuIGuWvO13gvv5o NtwyNqKhFVLRqduuE6b2Uk1+v9qJxsgm7YUcMha86yb0ozQ0QSWcJmapCXPU2bD65RPh roN6eBB6HTcsubIswr+8IvOv7FijrcPTdPF/Vdx3KhypSP34/+z4IL1XRdryiR1nVtOW CYLjhrL1t7qUbAmREjqXToPb6H5WJnuRl8d3EyHTv8InCqcM/Yjn5XDqKB9RC9YhkMGp HmIZCYkZdiCLwFbrDP3nlhHXu5IPwfmsyh6qxCWx5BqX1JD0TiFp2RWWT5SoRcuSvYuM 37aQ== X-Gm-Message-State: AIVw110rjlc8wyqRFSXqUOaVCn0qv/GLaq8z+Igd8UjM4SIn2qUUtwqq vX4hho1gOoFCqV6u6dI= X-Received: by 10.223.179.13 with SMTP id j13mr1365114wrd.228.1501768804524; Thu, 03 Aug 2017 07:00:04 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id q141sm2406504wmb.11.2017.08.03.07.00.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Aug 2017 07:00:03 -0700 (PDT) Date: Thu, 3 Aug 2017 15:59:55 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: dev@dpdk.org Message-ID: <20170803135954.GH8124@bidouze.vm.6wind.com> References: <6ed752048278cd6fcb1757ca305f5c6e0c86d2d4.1501763600.git.gaetan.rivet@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6ed752048278cd6fcb1757ca305f5c6e0c86d2d4.1501763600.git.gaetan.rivet@6wind.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] net/failsafe: fix resource leak on parse error 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: , X-List-Received-Date: Thu, 03 Aug 2017 14:00:05 -0000 self-nack. This issue has been fixed by Raslan in [1]. [1]: http://dpdk.org/ml/archives/dev/2017-August/072429.html On Thu, Aug 03, 2017 at 02:34:00PM +0200, Gaetan Rivet wrote: > If fgets fails, the handle fp is not properly closed. > > Coverity issue: 158633 > Fixes: a0194d828100 ("net/failsafe: add flexible device definition") > > Signed-off-by: Gaetan Rivet > --- > drivers/net/failsafe/failsafe_args.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c > index 932e371..3f6430b 100644 > --- a/drivers/net/failsafe/failsafe_args.c > +++ b/drivers/net/failsafe/failsafe_args.c > @@ -145,22 +145,20 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline) > /* We only read one line */ > if (fgets(output, sizeof(output) - 1, fp) == NULL) { > DEBUG("Could not read command output"); > - return -ENODEV; > + ret = -ENODEV; > + goto ret_pclose; > } > fs_sanitize_cmdline(output); > ret = fs_parse_device(sdev, output); > - if (ret) { > + if (ret) > ERROR("Parsing device '%s' failed", output); > - goto ret_pclose; > - } > ret_pclose: > - ret = pclose(fp); > - if (ret) { > - ret = errno; > + if (pclose(fp)) { > + if (ret == 0) > + ret = errno; > ERROR("pclose: %s", strerror(errno)); > - errno = old_err; > - return ret; > } > + errno = old_err; > return ret; > } > > -- > 2.1.4 > -- Gaëtan Rivet 6WIND