Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1762838ybn; Thu, 26 Sep 2019 01:42:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1oTVRikLPfG32+Uy6t4s/b+6UdYknHaJBqALsAGEhuzpn2rh0kFwYbHA9SWh0KUq8YvGt X-Received: by 2002:a17:906:cec3:: with SMTP id si3mr2002156ejb.145.1569487335778; Thu, 26 Sep 2019 01:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569487335; cv=none; d=google.com; s=arc-20160816; b=zoPn+o7L7DJlpD6pjPgSyatfMj6b7iDxi+b9b1vCDmZMjC2Wmz2YhliIC7SZZTDQK0 VHE9Y6OUWE66HFZFkJhMq9bQw1IALqPmNiv/8pcTH/im/HdwS1PGry6OZxckq+V+zU1O 7nk4fCFzj6j98gwLUe6KGtroBNKPl+hoGgbVTKLVVDNXTPCcPJRtW0A7s+6kTEuK6nPi acEzdUHGcV+7RrH1ios4rsaor1Hacma9USgdSZnDPEX0AoYk7DfjB74dfLGGsD9DkLZQ TpEXPsM/ZkGh7AAl4+aR6G6pYQHwPIUzTDBHO5Y5Mo/AK+Ab8UG5R6arI/AxzhwyRM+v HoYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=A5eS5NXht/vOaGonLfgI9sz4CtBniYeY84hPs1tCF1U=; b=CVWGzhx8/Cf6NRM8m/2nDxwX2MFUkJXTw9xywKI92CZXwfwH4VvyvyJL46eBl0YalK 2PlG33TrPVFtKD6AdDi0sy8hXUBiwyzIC6v5ITwglHY9fKi3dxcZIVvt1784gb+57KRe s+0wKL0vrNswHm9h6neiNa3cPKKiNeIknVjxUo4Qr2pQl3jC0x03KqDjlZ8flmqWKdeg /7z1beG3i0pj1gl4mwALq+M0f8XmX4Ka7z9suJlfnQ37VmaHyrmDWYgWZDqKhik4vYX5 0qAAoUbwPE6t+cvtGk+Bg7mfWKNUFD2JCml7Y/2i5z1+RS6nNXSdpZPHrqzi8VbI8aC4 Th+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pPnTCL2s; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u14si855942edq.167.2019.09.26.01.41.52; Thu, 26 Sep 2019 01:42:15 -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=@gmail.com header.s=20161025 header.b=pPnTCL2s; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407301AbfIXTVU (ORCPT + 99 others); Tue, 24 Sep 2019 15:21:20 -0400 Received: from mail-qt1-f179.google.com ([209.85.160.179]:37719 "EHLO mail-qt1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730858AbfIXTVT (ORCPT ); Tue, 24 Sep 2019 15:21:19 -0400 Received: by mail-qt1-f179.google.com with SMTP id d2so3562716qtr.4 for ; Tue, 24 Sep 2019 12:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=A5eS5NXht/vOaGonLfgI9sz4CtBniYeY84hPs1tCF1U=; b=pPnTCL2s+MDwOixyKhQt4so/dr7NxfSvZtoG6zTBeUbJnurN4L/Wt2417aeCaYQeHQ 0ARnrk4Edbj7XgxvCivBp6CAPlrUDiyRFNpAziInufexp8LXUrlMUxDy/r53xEe+ish6 2EglZW6obyuM4pHb1Jyl1V5MZi4w6+W85npiFwsZudv3lAU0TKEtFP+g4S9MQ2FqhG94 DsL0NRtFji9G7YdfRMK3bmvP/CyyyjCiwtOjy2vk1zF+c5apbh3WaxOPFR2MpKSX8LjD 8pWXrPOf1xIqcyjqE/MLQXC1IIUNqYEOpLo7FkQlC+dSFGxFGEEeHoj1pPW+cZRPYaHM /W3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=A5eS5NXht/vOaGonLfgI9sz4CtBniYeY84hPs1tCF1U=; b=PsIhQmv72lkj317evvdQBTjesBLqFdIJUT6SCk7OJhimAI+UlEOJ0kQwiOuG3gLMIq vw/Q/oS1GkS+GqsoHfCNlHafoD1C9AmMDQ+QYY9aJFnMXxPDyC/ejwd5/re1HvvTTBnH SzP3Wp1N0jUPHCDaVCO789mffjhyIjP+PO5ZizHcomAs9Hpkj/SigQJbHNxT0/4MUcTf LBbL6d2CJ2owv6AHxJ7niN2oRL3nVDgBLm61wWOMGrKRfM/Ta8DjAaLmj+co18WGwwI4 ChpRabNFLTgA5dzMStMr20P/wo6DZVKLw+i+dpE18HQZFChYMTDzW9ae//eZCKLRpGiI 9/cA== X-Gm-Message-State: APjAAAVsUJypfxLvzkG4FHCGk97Jrd8e/W/QmDJjOjgM46pF9CqlQ3c2 dJszV/o11/xsyxLotEWdfZY= X-Received: by 2002:ac8:7b2e:: with SMTP id l14mr4574224qtu.11.1569352878906; Tue, 24 Sep 2019 12:21:18 -0700 (PDT) Received: from quaco.ghostprotocols.net ([177.195.210.60]) by smtp.gmail.com with ESMTPSA id j137sm1571001qke.64.2019.09.24.12.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2019 12:21:18 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id A9DA041105; Tue, 24 Sep 2019 16:20:46 -0300 (-03) Date: Tue, 24 Sep 2019 16:20:46 -0300 To: Jiri Olsa Cc: Andi Kleen , Andi Kleen , jolsa@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] perf, stat: Fix free memory access / memory leaks in metrics Message-ID: <20190924192046.GA20773@kernel.org> References: <20190923233339.25326-1-andi@firstfloor.org> <20190923233339.25326-3-andi@firstfloor.org> <20190924075040.GC26797@krava> <20190924140856.GQ8537@tassilo.jf.intel.com> <20190924144418.GC21815@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190924144418.GC21815@krava> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Sep 24, 2019 at 04:44:18PM +0200, Jiri Olsa escreveu: > On Tue, Sep 24, 2019 at 07:08:56AM -0700, Andi Kleen wrote: > > > > expr__ctx_init(&pctx); > > > > + /* Must be first id entry */ > > > > + expr__add_id(&pctx, name, avg); > > > > > > hum, shouldn't u instead use strdup(name) instead of name? > > > > The cleanup loop later skips freeing the first entry. > > aaah, nice ;-) > > Acked-by: Jiri Olsa Thanks, reproduced and applied, before the patch: # perf stat -M IpB,IpCall,IpTB,IPC,Retiring_SMT,Frontend_Bound_SMT,Kernel_Utilization,CPU_Utilization --metric-only -a -I 1000 sleep 2 # time CPU_Utilization 1.000470810 free(): double free detected in tcache 2 Aborted (core dumped) # - Arnaldo