Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1464190pxv; Fri, 16 Jul 2021 09:54:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlZBGyEmsk1OvuWq3f5aJ1ff9og7ovZ5xeLOuK7otGevrcF3gNSCQBxsK9fQe+2DIEc7Mb X-Received: by 2002:a17:906:34ca:: with SMTP id h10mr12973790ejb.41.1626454449407; Fri, 16 Jul 2021 09:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626454449; cv=none; d=google.com; s=arc-20160816; b=couXcppK3WR22mkHwk1zqzpmnLysFhuMQ5RgKKvUhbNacNnGAsuONfvKnF1PevcX0W sRaeJQlf9PoMPT2zvbkRFmxxg0yf3XtXPUH6p0CJ47YnQbNLr2X06JEWYnhg+T/GUi8s G7tR0RA/Wi83oIQC4fnyEPOoCWUPd7r0uPb+N4w/grcJ/tuQZEZqa8QT9ebC4MAClUd/ 0wmcouMd+Wqry38ypkThED78FrHzU+DDMAluAdlnOQPhnsyxUp1GgbzrI9ZUakjrQmSf YhhdUuRRUn5VqmOH7jGA1PwmxNNGrOHDZD0ROMGuTlDvwWwifshVljEZVJCvHnLNBnHZ l4DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3QdZwjPV1UGnboZpPp5Rm2HRlenWOniC86VkcRxpHzo=; b=b4W7Em1TLcUN+rZ3k2DRjYo1rTCl66HCWCpV9e8P8TTeUcDckRu+aJjUYkLHmvLTqT ZJSt4J8gbS2ckjDWZ3x7HE4phxlbyXtFPFpViPVat6GJTyqZpADamxwUqIaEct01ULU/ EvDgf65fCgAQdLMSr8D9CQT8CxwISu3upFX4+rVKfI2GOzoF9jfFknOJn9zMiOEbbpJm daLF6ULkjPVDebnsXCSBcpdOV2ainX89wCrIMycbXOW2emhisrwat5TwHFfVgzr3P0q3 I6YFIgvLK1R+Y0TsSFOkVru0fqE4dD98PrKjT5ljqlHhGQAe0FkySgE6vss1ruUlEIfp 6q0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L9xhBcOn; 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 9si12262654ejf.618.2021.07.16.09.53.44; Fri, 16 Jul 2021 09:54:09 -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=k20201202 header.b=L9xhBcOn; 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 S229794AbhGPQxL (ORCPT + 99 others); Fri, 16 Jul 2021 12:53:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:48792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbhGPQxK (ORCPT ); Fri, 16 Jul 2021 12:53:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2377B613E8; Fri, 16 Jul 2021 16:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626454215; bh=fR1eM/k0XR7Gjhkw/+2oWO8IaDRE53G+CK69zJwzPmU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=L9xhBcOnRgZA5EVe5cuHX1nLFC/iRx55ZmhUjTRsUURldVwYETJaETU8/sdZpm0Dc HuTNbtPmwHNvLU/RaeOGhU50wkb4pzLOD9eP0CgvL1Ky1+zOMh27PzLtRw0WJa049n L93kAOJryx5HoULBcauUTuVhZUkGRZWoH5sio+TC108R98ACfrZeplIHVbE0m1ICEJ TN4VsWmRvVE/p4Tcy2fH7GRKX7XjicmTKi/ZOLOyp+XfJZGGEr0f9JidLaLhcccvRT +bzZwXUtmrEb9Wi/QlwBBFllgC1DDS8qKxsrtR6tBF2b6h+0Byc2FVw9L4jZGlLU+0 9ruczedy1v6nQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 8A601403F2; Fri, 16 Jul 2021 13:50:12 -0300 (-03) Date: Fri, 16 Jul 2021 13:50:12 -0300 From: Arnaldo Carvalho de Melo To: Riccardo Mancini Cc: Ian Rogers , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH 19/20] perf test: bpf: free obj_buf Message-ID: References: <60f3ca935fe6672e7e866276ce6264c9e26e4c87.1626343282.git.rickyman7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <60f3ca935fe6672e7e866276ce6264c9e26e4c87.1626343282.git.rickyman7@gmail.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Jul 15, 2021 at 06:07:24PM +0200, Riccardo Mancini escreveu: > ASan reports some memory leaks when running the perf test > "42: BPF filter". > The first of these leaks is caused by obj_buf never being deallocated in > __test__bpf. > > This patch adds the missing free. > > Signed-off-by: Riccardo Mancini > --- > tools/perf/tests/bpf.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c > index 33bda9c265423547..2cda4a6297e07967 100644 > --- a/tools/perf/tests/bpf.c > +++ b/tools/perf/tests/bpf.c > @@ -276,6 +276,7 @@ static int __test__bpf(int idx) > } > > out: > + free(obj_buf); > bpf__clear(); > return ret; > } > -- I followed the advice and added the stdlib.h include, elsewhere we're getting included via some other include by luck. - Arnaldo 66 6.97 ubuntu:18.04-x-m68k : FAIL gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) tests/bpf.c: In function '__test__bpf': tests/bpf.c:279:2: error: implicit declaration of function 'free' [-Werror=implicit-function-declaration] free(obj_buf); ^~~~ tests/bpf.c:279:2: error: incompatible implicit declaration of built-in function 'free' [-Werror] tests/bpf.c:279:2: note: include '' or provide a declaration of 'free' cc1: all warnings being treated as errors /git/perf-5.14.0-rc1/tools/build/Makefile.build:139: recipe for target 'tests' failed make[3]: *** [tests] Error 2