Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4234778imm; Mon, 8 Oct 2018 17:57:21 -0700 (PDT) X-Google-Smtp-Source: ACcGV63pDphSBYzm5hwSzl6edPyMwOmAKjyMqZaOuXv7iM7OlYK+0VlOGkby53kvU/0tgll0i5qv X-Received: by 2002:a63:d84a:: with SMTP id k10-v6mr23626707pgj.314.1539046641844; Mon, 08 Oct 2018 17:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539046641; cv=none; d=google.com; s=arc-20160816; b=lBeee4G9BPX9rLMfiobiqYSuTXLkPxGl2lTVi6gwAKZOKrBYoqMppUSjKAyb9zpFs+ tS7oGZWeTJBBShPna+RbOZaSYsXDnZLRG2o/Kxgy6lTvozGFPKAzHoLgl3wKI4X2FMDC dufYRCcqqiMDBWrrm/BszBQOuEloUuYAK6RApTZF9GvkIIN08iUUYVzDdRhbFQlmI1Gl 01XvGNScw4Ivh9aU9bj+R1qrH+ajBSNYTyAE6t27w398XRinwFVpQw9VXWUH+EdgpNyH NBm/h4M5CXxCn37DXNzLaULCrW0YxSVj4gsQFjFtdf1/mmK3DBGQiiei0tEZM5PXw7T1 IuLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Rcijj6IdCWbBnJBBW7atAzdu4fT52IPSAzdMVZdh64Q=; b=BZyGq2N2CsOmef+LuZ4UdmSVkMtsD1SzLcD8Of1Zql/Hmnfibz/ROvZlbXVL6BsGb8 bfFB/D2oUKUCASr/ERp+zYSHk3YMdVr7syl9hRvX7qzivbtfJ+C40IjR/2eGbKZTTvPm S53hd6cy980L3CYECcxRuJykdH7F6dfdeINj8uulAg/ZynXDYfCq9Zk9iJIPfgHJlz4g lN9tRyJTlGcQSkmFa8AAsDwbmYzIIR79j8mmEGMB/NNePz9qQaSHdx2wxlO6GJJ05fBU w5GBygQPQL0GP44c/5WNABNiRnTzWlbgbncQoS2x3kitT9gUEzyaxjtonycviAwQBhPQ 7IeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yLPmqO9A; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 204-v6si21953587pfx.155.2018.10.08.17.57.07; Mon, 08 Oct 2018 17:57:21 -0700 (PDT) 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=yLPmqO9A; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726903AbeJIIJ1 (ORCPT + 99 others); Tue, 9 Oct 2018 04:09:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:42118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726786AbeJIIJ0 (ORCPT ); Tue, 9 Oct 2018 04:09:26 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (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 1F41B21479; Tue, 9 Oct 2018 00:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539046505; bh=vCH4BGcU490C1hejq4bVHmBn5xYR0XQhwD2yp/QNtUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yLPmqO9AOa7rl7pokUIgKMSFtRI7Tgo0xB3zUCXao4+CUQ/EsuQYYOBnU6hZB2lC3 mZ517zp+Yokl6GgPa0MdgL1zcWM5Xx4UWyswQUN9oJ5Fn04h8+qK0HNZU1B0kv4kR6 2rztPSpj/P8Q0fSk7luq1M2VQzEh4sw2LTpe00Fw= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Sanskriti Sharma , Joe Lawrence , Arnaldo Carvalho de Melo Subject: [PATCH 05/12] perf tools: Cleanup trace-event-info 'tdata' leak Date: Mon, 8 Oct 2018 21:54:20 -0300 Message-Id: <20181009005427.6607-6-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20181009005427.6607-1-acme@kernel.org> References: <20181009005427.6607-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sanskriti Sharma 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 --- tools/perf/util/trace-event-info.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index 7b0ca7cbb7de..8ad8e755127b 100644 --- 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(struct list_head *pattrs, "/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; } -- 2.14.4