Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3439646imu; Sun, 11 Nov 2018 15:07:57 -0800 (PST) X-Google-Smtp-Source: AJdET5fgfhF5tp8j1iGo+0axjuLDocWJgTyqpU3GPNRYj+hyeGsPRapGFmsxwFPzMDpiiFkwt1Hz X-Received: by 2002:a62:995c:: with SMTP id d89-v6mr17679559pfe.11.1541977677617; Sun, 11 Nov 2018 15:07:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977677; cv=none; d=google.com; s=arc-20160816; b=bhdAeEnnbXJQh/1R7ZGHm7vbOqFD3fmutEkel/ZbQpQIyhqAcLPnUnvO/8bZMts9mw Z0FxMQY57xE4AG2nuKe3LzDCNJFuZWIS7knuEykgcq8Hau6+06w7ph9blhnv8Sf9i8LH 08ISRZglJG0mYpB8EjgFhZbmdFGUNEoHJT07UJ+M6UokP/QRpB6yL9TXsaJ/6yTmf2t7 E+hWwz7UMSVZk1zPyPYDymd1tvxLzUeR6Pl7fIV4BYdVksxKawATehMmDUhimg6HBg+H sIzUQBsMiMLOV5hisUN9QIdlAt0SgYtmb+jxAfKzFoEQ4T/B8OQ7PiVNNQvk7EwnAsuF wAGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yzR7EEViwjntRiJ3CgCRPR0IujfBu9vnVYgeq5FyOlA=; b=S/de9K8yN+pzC+OPfUJFfY7/JIi+Cs8yEzDn9N2UMKhy/llgXxuAYyI4azz3HestaE 6SGVL9eyh8yn8EMZRMGDaxftKTf/38+aVq15vFKLnFcq5sR34CIJHNysx7gFzKWeDdQm LryS5HaR4BeU7JW3YTIVwLm28KqAQbftysyfNFCAWFGCIlbIILS4fdmWTVDAg+PBUn3L nrbWdu/WO+Juzcc1VBmNa4wXqUoMt0K3FYwxKXYwkBN9nEeq0L/7wq0lyCQ8qzomp8XL rpXlrkRmlV7wcoZxH7ZwaTRSdeK0q448YTlsb4CTXP0RKbjhsWSwS4nAcpd/HxSvHh9Q B3tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="knm/x9p1"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a123-v6si13821117pgc.219.2018.11.11.15.07.42; Sun, 11 Nov 2018 15:07:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="knm/x9p1"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390408AbeKLIWO (ORCPT + 99 others); Mon, 12 Nov 2018 03:22:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:51232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390365AbeKLIWL (ORCPT ); Mon, 12 Nov 2018 03:22:11 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C2C56223D8; Sun, 11 Nov 2018 22:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975534; bh=8eo0BwhRhJzevfHRkRTo4LEzwJwguEtxV4rQyrORgJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=knm/x9p1FEjQANcZcwshNIAB/YPUQlPaqUBCAsmVeXI3X7lFeMOx2jhA5LDOpd0EC bCJInnHjtjX9+rF2HAsvV3QiKvJIQdg64XhrQztJQiWNnhnG3naS3/hS3bQXLPsrLt ytu40LwliynClzutBjFmWXT3huQICgMoZHJL+mvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sanskriti Sharma , Jiri Olsa , Joe Lawrence , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.14 049/222] perf tools: Cleanup trace-event-info tdata leak Date: Sun, 11 Nov 2018 14:22:26 -0800 Message-Id: <20181111221652.492394695@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sanskriti Sharma [ Upstream commit faedbf3fd19f2511a39397f76359e4cc6ee93072 ] Free tracing_data structure in tracing_data_get() error paths. Fixes the following coverity complaint: Error: RESOURCE_LEAK (CWE-772): leaked_storage: Variable "tdata" going out of scope leaks the storage Signed-off-by: Sanskriti Sharma Reviewed-by: Jiri Olsa Cc: Joe Lawrence Link: http://lkml.kernel.org/r/1538490554-8161-3-git-send-email-sansharm@redhat.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/trace-event-info.c | 2 ++ 1 file changed, 2 insertions(+) --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -533,12 +533,14 @@ struct tracing_data *tracing_data_get(st "/tmp/perf-XXXXXX"); if (!mkstemp(tdata->temp_file)) { pr_debug("Can't make temp file"); + free(tdata); return NULL; } temp_fd = open(tdata->temp_file, O_RDWR); if (temp_fd < 0) { pr_debug("Can't read '%s'", tdata->temp_file); + free(tdata); return NULL; }