Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp875947pxk; Thu, 17 Sep 2020 20:02:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyv4+JCFto9P1Pg4CmWOPS3IH5bThfp9759JuRq1cHiB2jl1SzBMH3AZpnPGyaPa8RIBuma X-Received: by 2002:a05:6402:515:: with SMTP id m21mr36904887edv.348.1600398131899; Thu, 17 Sep 2020 20:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398131; cv=none; d=google.com; s=arc-20160816; b=Kmt6Vc2Sft6QkCK6lPaIQMCkIiDZQ0sy1v+9ekqOeSIbcTTAtrnOuIEDP1XY94cNx/ Cvjpdp+MwP1gwwe2wyilQdKulC3CKyhQwVG2Uo6LxNgq3WQaIqb3a4oCCEe/G9LvnmsH u9nUDCNC5V5L0QiaV83mlvU09C4F2qVZI8eDTEqvotr/dPRKjlnQorwFrvRz/hRS4gZ7 6DABiH4WDFLhXNwdaXxMKWN/t9YwtQmGHeTEsyo1RkMYEdc5AD7Tb9UPL4JfrclEI9Ig HGYX23oQUZ1a3jqN9DG2UH4g03eQS3SdF8TTzKwEqqavO1raLf1NjJAptfwp05SufcVx lMvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KWqSG4Pwiufe8wyhkofvAg0RcCwcA65fVqj6mTIlCbE=; b=ukZid7Y8krR4wrMdU8u5CBdDU04S7pI88ccRJbeZs63y8W5bQ2n8j56Yv23TV21SCc VxjjahBf04a/3dkx/yAcw5k56TocXaKGIQQdCT5tZTT14hXeKZRLl3rM70Y7sV1Qolaz JF+s6PySGK4lKaPUJldqb7l54S022Rl7P7O9ev/6eILZ/V79nm1S3id1zUnTwkfOKZFG NxivX5lkvmcdC8flCgu3sSsyfeWebLZ56knYakCZStgKhOvAk/vUfEbkyMGdORjFVEMH FOh0qhhFbEaQ8QCy+Na+XTKRlI+CEkwMuJXiNsL7i9GNhl8gBnCSKkcPjiSwr/ZBaLWe 8vzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fzuem9H6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id a7si1089751edy.401.2020.09.17.20.01.48; Thu, 17 Sep 2020 20:02:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fzuem9H6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729261AbgIRC6B (ORCPT + 99 others); Thu, 17 Sep 2020 22:58:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:55682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727718AbgIRCGX (ORCPT ); Thu, 17 Sep 2020 22:06:23 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5AD7E2376F; Fri, 18 Sep 2020 02:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394782; bh=83MNxDNgiNFO2tB3IzunfvUoedfzU3c65MHiEWcfxQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fzuem9H6qo3BzuGv/OXMs3ApLD7tavtt6T1hy3co0gDUVgB2ZAFoE+y1t0CwcCUVR GEqKe1kBgwmux6DzgtMmwLPLlTOkmLJJp168+GQ5kl0GikHxE47FaIaqZ+SiMQpIHK 68KdbRHhqJoeNE91q6mDWrZ5W/M/RMLPvDulUdLA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ian Rogers , Jiri Olsa , Adrian Hunter , Alexander Shishkin , Andi Kleen , Leo Yan , Mark Rutland , Namhyung Kim , Peter Zijlstra , Stephane Eranian , clang-built-linux@googlegroups.com, Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL 5.4 255/330] perf parse-events: Fix memory leaks found on parse_events Date: Thu, 17 Sep 2020 21:59:55 -0400 Message-Id: <20200918020110.2063155-255-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ian Rogers [ Upstream commit e8dfb81838b14f82521968343884665b996646ef ] Fix a memory leak found by applying LLVM's libfuzzer on parse_events(). Signed-off-by: Ian Rogers Acked-by: Jiri Olsa Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andi Kleen Cc: Leo Yan Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Cc: clang-built-linux@googlegroups.com Link: http://lore.kernel.org/lkml/20200319023101.82458-1-irogers@google.com [ split from a larger patch, use zfree() ] Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/parse-events.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2a97a5e3aa91e..5fadad158db59 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1370,6 +1370,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, list_for_each_entry_safe(pos, tmp, &config_terms, list) { list_del_init(&pos->list); + zfree(&pos->val.str); free(pos); } return -EINVAL; -- 2.25.1