Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3487471imu; Sun, 11 Nov 2018 16:12:46 -0800 (PST) X-Google-Smtp-Source: AJdET5e2jJvTxfuEHitOTepjaPbCjV9Bkg5CtbT+0nXnAnopjM/+pwF/7TqgX4Z43pk8kj5+9TlJ X-Received: by 2002:a63:5722:: with SMTP id l34mr15547793pgb.118.1541981566373; Sun, 11 Nov 2018 16:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981566; cv=none; d=google.com; s=arc-20160816; b=po/UDLEbhYcBU2XTcepZ2Z5GYirfD0W7WzyQSNvKeZAJ6s7DgWL9s83DXiAJf7Nt0L S4i+RxXdm4lrd6nFgdFcKPqBPLWk5XO39bCQRNSdRq6Vw+JQ8ziGwXCPc+5et84k7w+D k3B/E5uYURffiZ9szVI1dUWhKoTHD8LisSNo9pkmU/4+3+GhNzf7ZOtzgYYgMFnY6nrU bNASvMeiVdk3w9A5S3y/lD5k1D8Bv/8A9aWrTmrOqjb3W5sQi+fNg2ihnN6YBaOi4Dlb s686ffZVY2xTo25l5uVPfoYBwMcmfsyH0wiR1OlrsMxC/KTA9AoC/+c047Ps2KVzywnb isDQ== 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=seev04XiZ3tFs7EZW4b1h0Wgt2/SREPx0yKUbcZQ2zk=; b=lMTBUP7IqX2UTPCc2y7xGQ+8afKNiZ+tDPBwlLSTZbQ5IsCPgF0b8lb/hzkw85TDuf qMVD0h9db47u9+BDcgD2pTHA8DS2Jy93kofv3pbqWjvA9WBf/UplBMKer/aB8+zH6l93 yaW/eogDLhz77UpSy2DdR4vh6fj+mW9eMXyhWoB3UUxdddshRmpqzrIY0Yio/ZFVdb1V YdY7hYJY51CnF50qgw7DVuA8prQT9lVxXuhslvNOhXRFjcn82SH+VSjvyR40U4bW3S2K W7m4IXeOMhR1AJQIZNfEVl5M1qXvjFZJoSUiIi7LTxa/06t9wuSBHFnXOMAdeq8vZ4c0 E08g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zu6+RXCP; 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 r28si12490188pgm.317.2018.11.11.16.12.31; Sun, 11 Nov 2018 16:12:46 -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=zu6+RXCP; 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 S1730586AbeKLIRR (ORCPT + 99 others); Mon, 12 Nov 2018 03:17:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:60196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730501AbeKLIRQ (ORCPT ); Mon, 12 Nov 2018 03:17:16 -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 4E06D223AE; Sun, 11 Nov 2018 22:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975240; bh=fx5CcTpc9pdoqj2vpjKBHaVUZSkvea3kdBUvnWHYIhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zu6+RXCPK6BBisP/SBjkZPmgj8IQ0eUNygFBPAdCpmb/+HlmKf5kt62C6ij+Bo2n8 S9jb8esX1CY7rY8X1x3iU0n3VvVQL36VOk+zDTARnNss9evl+irtLcmRK5BpDGCaQd 7kQu/VODlmCQAe1zUmGCbLEXTYt/pfLAc8iHhcks= 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.19 065/361] perf tools: Cleanup trace-event-info tdata leak Date: Sun, 11 Nov 2018 14:16:52 -0800 Message-Id: <20181111221629.078342055@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@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.19-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 @@ -531,12 +531,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; }