Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2962733ybc; Mon, 18 Nov 2019 07:26:25 -0800 (PST) X-Google-Smtp-Source: APXvYqzalI2DHHRrnVOBGnj/NL/Pzj9LjP774+AfL3pRHEKlQdxZkLpSPijoknYw2odJHiPhF0Fg X-Received: by 2002:adf:d844:: with SMTP id k4mr29755560wrl.333.1574090785838; Mon, 18 Nov 2019 07:26:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574090785; cv=none; d=google.com; s=arc-20160816; b=zoJVne1+qM+1I1PBqutI4GLy7iz/8uF/VnRGRdRWyUQ27RDnnRDy2q52FX8bG/81nU BS+1ORX4/1Dvs1bigNsYQuKaCDRwVvwzDt9LuwU+9ZzIb8WL8mmoEdFJaagnPpm6gmyU IzszLYpXjiOB8rt7MMuRbPxRVA6XxY0cFX7RrlW+Nr557TWeEB+Z59Rqz6cVKUxejIUs tzbXwq03P3uiAGlVEyFi+yAU7ZRb/XNitlw2KN5opdEjepYUz8CndpBGmeXvZDtBpFnc eMd8lePW8DdzcF+Vanp/efRpmB1FfaWSeIW2u21J7fW4k1rzf+XyJSbn7H5PUbRm4Esf UttA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DLGi9fY1vNkBVsN98gcHesJsA6BDlVXAshm64cOSSz4=; b=WA3fD7TB0435iM6Ms/qVYO+nD6twd2eyDYdodokAQsGPuvhUpPNhwX6UfCYdiQ6mDI DLhuYL0EpkEG8EV93VW3fnx999LgzkmIw/S2N2O3NjO5cMmDak4+U2iXbCokLDSVijFp NMfr5oZORhBdQG/5kXWRAZHM3P5bP8XnqTPivxJtRjymjJ+4xSWo0MoseQJi/wYfjHzK iegIJK8X5VmEmskSFTX9UVZClXrvsJ2Ze2z+82JjKjpBfRWXQZQizf7Mbczw9taTqIfS aoTfDL2tut5+KmArO4r2OCDW0uINcNT1dumSEzceNW1TmzF0Jx2WC1s1k7aFNfcnQ8l1 IiJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hC0pYwsv; 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 v11si13582536edc.410.2019.11.18.07.26.01; Mon, 18 Nov 2019 07:26:25 -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=hC0pYwsv; 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 S1727173AbfKRPYo (ORCPT + 99 others); Mon, 18 Nov 2019 10:24:44 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:34246 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726578AbfKRPYo (ORCPT ); Mon, 18 Nov 2019 10:24:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574090682; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DLGi9fY1vNkBVsN98gcHesJsA6BDlVXAshm64cOSSz4=; b=hC0pYwsvDkCiqXlusZlLNS3pgZtv88W536o1JO+a3TkC5L3pQXVk5cPjN9Y7mmYdLj4Pq1 Mt2FSyPPAG+fi6QpRf9BOml9t2DwbjlHwUCSsJ0GwtAUl49+Uf/+KBV+ESLsFTdJd/aopG GeIhc6QlyjvIz1WNx/IsyymH8By06Iw= 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-22-lEWPb9egMsaMiMSNAklbLg-1; Mon, 18 Nov 2019 10:24:39 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1643718B6409; Mon, 18 Nov 2019 15:24:38 +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 5F57350229; Mon, 18 Nov 2019 15:24:36 +0000 (UTC) Received: by sandy.ghostprotocols.net (Postfix, from userid 1000) id 87A4411E7; Mon, 18 Nov 2019 13:24:33 -0200 (BRST) Date: Mon, 18 Nov 2019 13:24:33 -0200 From: Arnaldo Carvalho de Melo To: Steven Rostedt Cc: Hewenliang , tstoyanov@vmware.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, linfeilong@huawei.com Subject: Re: [PATCH v2] tools lib traceevent: Fix memory leakage in copy_filter_type Message-ID: <20191118152433.GA3667@redhat.com> References: <20191025082312.62690-1-hewenliang4@huawei.com> <20191118092844.7292ad26@oasis.local.home> MIME-Version: 1.0 In-Reply-To: <20191118092844.7292ad26@oasis.local.home> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: lEWPb9egMsaMiMSNAklbLg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Nov 18, 2019 at 09:28:44AM -0500, Steven Rostedt escreveu: >=20 > Arnaldo, >=20 > Can you take this patch? Sure, taking this as an Acked-by you =20 > Thanks! >=20 > -- Steve >=20 >=20 > On Fri, 25 Oct 2019 04:23:12 -0400 > Hewenliang wrote: >=20 > > It is necessary to free the memory that we have allocated > > when error occurs. > >=20 > > Fixes: ef3072cd1d5c ("tools lib traceevent: Get rid of die in add_filte= r_type()") > > Signed-off-by: Hewenliang > > --- > > tools/lib/traceevent/parse-filter.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > >=20 > > diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent= /parse-filter.c > > index 552592d153fb..fbaa790d10d8 100644 > > --- a/tools/lib/traceevent/parse-filter.c > > +++ b/tools/lib/traceevent/parse-filter.c > > @@ -1473,8 +1473,10 @@ static int copy_filter_type(struct tep_event_fil= ter *filter, > > =09if (strcmp(str, "TRUE") =3D=3D 0 || strcmp(str, "FALSE") =3D=3D 0) = { > > =09=09/* Add trivial event */ > > =09=09arg =3D allocate_arg(); > > -=09=09if (arg =3D=3D NULL) > > +=09=09if (arg =3D=3D NULL) { > > +=09=09=09free(str); > > =09=09=09return -1; > > +=09=09} > > =20 > > =09=09arg->type =3D TEP_FILTER_ARG_BOOLEAN; > > =09=09if (strcmp(str, "TRUE") =3D=3D 0) > > @@ -1483,8 +1485,11 @@ static int copy_filter_type(struct tep_event_fil= ter *filter, > > =09=09=09arg->boolean.value =3D 0; > > =20 > > =09=09filter_type =3D add_filter_type(filter, event->id); > > -=09=09if (filter_type =3D=3D NULL) > > +=09=09if (filter_type =3D=3D NULL) { > > +=09=09=09free(str); > > +=09=09=09free(arg); > > =09=09=09return -1; > > +=09=09} > > =20 > > =09=09filter_type->filter =3D arg; > > =20