Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3687157ybl; Fri, 20 Dec 2019 13:48:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwqkL5DIFglA+BUttL7NBIXAwppXJO+LxMkwNJM61mxqYx3z5HYw21juBSkCjAMTYIcB5rM X-Received: by 2002:a9d:6183:: with SMTP id g3mr17372216otk.304.1576878528352; Fri, 20 Dec 2019 13:48:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576878528; cv=none; d=google.com; s=arc-20160816; b=l2SmmRkaunxh7YOrGgwxEOKJHZUwbjM3oGnOu0L/5TIjHwH7fI7oRP0PtM83RKQAz0 PGRD90ib51TQghgoJoXD+GqxodWMgE1UenJpQy/k7Y8xcBEjUlX/O16wlVesz3T2hVlU VK1CIKwek1k7D0VH5MYIMoV/HmDZP0wafwtYGaChHq4k8CxDv/YaxQyg/ZxRPRSo6fmE PrJC1/1SQZb4U1I0cyhJrKk3g/An9qvsM5he5Ec4iJBjnnsh31oXzNhFPEHVi7ky9Pgd Wr/PdC1ZlwZmlB1nBFqV0JejVQ5CW5+AwmmTtJhZjkvgJbgUIdO2D8dz5LrcJTElVicO K20Q== 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:from:date:dkim-signature; bh=Bh8DaEb0kYFOBKnx1w8yAO5IROeyH1fTcPfoEsuwvnk=; b=cHL8bpR7Chuev2l+vwq1y8Z71Nofvc57b5O4tNSHb7IifGRN/LXCgHLl5XWc7AUE/N Kpbg1JyIAsRVO7HLnyeEcND9V4YFtpflFbnEzenDXpA8gJySEVCy68W3mWh9TIlq/Sot rgjMMbBRJ+qTHknBbU3eiwIEz5BhZ/GlvT7Agl2K1PoAtAzrEx+5aQ4TAABsCxg1Kckf C2JQyw2gHoRicxu4b5LsTEidXhAi7fys7SOr6gHswMeZTWm5EDb9GVnwRZ8EBhPMQmHQ 2CXCFaWQJcY0H6go7E1fddtHOwRocHQ99K+I4SwYhtZ3DnXTBqAnFeqnKPrysnN8HZVj qe3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g3eQejOT; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v21si5796293otj.282.2019.12.20.13.48.35; Fri, 20 Dec 2019 13:48:48 -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=@redhat.com header.s=mimecast20190719 header.b=g3eQejOT; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727513AbfLTVrr (ORCPT + 99 others); Fri, 20 Dec 2019 16:47:47 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:28931 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727422AbfLTVrr (ORCPT ); Fri, 20 Dec 2019 16:47:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576878465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Bh8DaEb0kYFOBKnx1w8yAO5IROeyH1fTcPfoEsuwvnk=; b=g3eQejOTxXI2erMaplkyhBI55lwJvokNhTx6DR2GRqrUjSukbfXFbUJGfk7mFPHCiSlar2 I/tYo+ClpcHKRWOshixrEUMoSQr7TlZG5CcFxU4bAGrqYs7HUNPbtDWkvVbEP1jwQtSGoL huzHh3v7QZfgLdFFT3lxMT84eLk0cnk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-286-5QeP2pOWN6evlcZCAwIO0Q-1; Fri, 20 Dec 2019 16:47:42 -0500 X-MC-Unique: 5QeP2pOWN6evlcZCAwIO0Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3BECF91221; Fri, 20 Dec 2019 21:47:41 +0000 (UTC) Received: from sandy.ghostprotocols.net (ovpn-112-10.phx2.redhat.com [10.3.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 512521001DD8; Fri, 20 Dec 2019 21:47:40 +0000 (UTC) Received: by sandy.ghostprotocols.net (Postfix, from userid 1000) id 7A05E11E8; Fri, 20 Dec 2019 18:47:37 -0300 (BRT) Date: Fri, 20 Dec 2019 18:47:37 -0300 From: Arnaldo Carvalho de Melo To: Steven Rostedt Cc: Hewenliang , tstoyanov@vmware.com, linux-kernel@vger.kernel.org, linfeilong@huawei.com Subject: Re: [PATCH] tools lib traceevent: Fix memory leakage in filter_event Message-ID: <20191220214737.GB3582@redhat.com> References: <20191209063549.59941-1-hewenliang4@huawei.com> <20191219205631.2e12571c@rorschach.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191219205631.2e12571c@rorschach.local.home> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Dec 19, 2019 at 08:56:31PM -0500, Steven Rostedt escreveu: > On Mon, 9 Dec 2019 01:35:49 -0500 > Hewenliang wrote: > > > It is necessary to call free_arg(arg) when add_filter_type returns NULL in > > the function of filter_event. > > > > Signed-off-by: Hewenliang > > This looks fine. > > Reviewed-by: Steven Rostedt (VMware) > > Arnaldo, care to take this? Sure, just landed in acme/perf/urgent :) - Arnaldo > -- Steve > > > --- > > tools/lib/traceevent/parse-filter.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c > > index f3cbf86e51ac..20eed719542e 100644 > > --- a/tools/lib/traceevent/parse-filter.c > > +++ b/tools/lib/traceevent/parse-filter.c > > @@ -1228,8 +1228,10 @@ filter_event(struct tep_event_filter *filter, struct tep_event *event, > > } > > > > filter_type = add_filter_type(filter, event->id); > > - if (filter_type == NULL) > > + if (filter_type == NULL) { > > + free_arg(arg); > > return TEP_ERRNO__MEM_ALLOC_FAILED; > > + } > > > > if (filter_type->filter) > > free_arg(filter_type->filter);