Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp832638iog; Fri, 17 Jun 2022 15:00:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vuzBr77QQXmDBAtGfgPsq6CsfWsdtFGBCw+Pl5FdStF8kBUsMEWdjwdmGrnIvg4ZiqyNdI X-Received: by 2002:a17:907:97c4:b0:711:d56b:4eb7 with SMTP id js4-20020a17090797c400b00711d56b4eb7mr10819868ejc.410.1655503206238; Fri, 17 Jun 2022 15:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655503206; cv=none; d=google.com; s=arc-20160816; b=GIeFmC8kSSjOplpnnp5FWkpEVJDD/V2NvsxTJenfFCGqy6gPltvt2MtNlZgUc8sQuj 9ZzuKNObBDnwn7bl5WjZU2vhLkO0EeOvX432RtW7DnhTAg4lRZts64egEZA8FAAxDWPz gVBCySvfuB7++Gt8fm0e5IzT+TlhbVdQVHN3lPqhKM1qLgH+9Lxc9mOC2XZ9c1RmQtvD cOK0AfBWso66IqyQZ7sqSEHbVt/3iUgFP0fGnAd9PRxoKqAFE6cHvNenwOwkSy4lhcqZ Xko2rTWBx5uIsE6aHQ/ygowf0IzCiVY7jDNyEtuSdrjogEu3QHSSFmgWzg6z8sAyqyBJ jDZA== 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:subject:cc:to:from:date; bh=IuGmfk+mW2CSKyQbsESqmc/LG9rtwMWwkPmSk9jJehk=; b=ckMvYDH0cGnGBRPoTEqmQLDPW3xtBQfViWyInZDYCQoTmj5MHikYGLgG1ZLDmHNN0W ZjULj/67qvww6chNqjh40PyVo9MmUQZi8JlowDXEMF2SQPyUvU8L/j1conjJFBnJs6gQ TIu5DR9JCxGWGvC70eR71rKqBHQZVCY2NqvBH6vY1oCTTzr6L0dZrOAx7xCypSU7liyJ m8ObbZYK26dQcidBsG/6AxhllZUWaGvu2/nTNd+fpAZz7qDX/FOd1bTO3IPW0FiSVFkb WA+wrlPCDg9xAkE6zPpLCSYuLf3zvWP78/xsspJX/J6GLuKYekttzgr7j7dN0jEWlf0p 0iyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a170906778e00b00718cbe0ad2fsi6066741ejm.210.2022.06.17.14.59.41; Fri, 17 Jun 2022 15:00:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235735AbiFQVr2 (ORCPT + 99 others); Fri, 17 Jun 2022 17:47:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230238AbiFQVr0 (ORCPT ); Fri, 17 Jun 2022 17:47:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 846CD54188 for ; Fri, 17 Jun 2022 14:47:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B591B82BDB for ; Fri, 17 Jun 2022 21:47:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF99EC3411B; Fri, 17 Jun 2022 21:47:21 +0000 (UTC) Date: Fri, 17 Jun 2022 17:47:20 -0400 From: Steven Rostedt To: Wang ShaoBo Cc: , , , , , Subject: Re: [PATCH 1/2] libtraceevent: fix memleak in make_bprint_args() Message-ID: <20220617174720.6f63b5c8@gandalf.local.home> In-Reply-To: <20220513023308.2400381-2-bobo.shaobowang@huawei.com> References: <20220513023308.2400381-1-bobo.shaobowang@huawei.com> <20220513023308.2400381-2-bobo.shaobowang@huawei.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 13 May 2022 10:33:07 +0800 Wang ShaoBo wrote: > Release arg allocated from alloc_arg() when strdup failed in make_bprint_args(). > > Fixes: a6d2a61ac653 ("tools lib traceevent: Remove some die() calls") > Signed-off-by: Wang ShaoBo > --- > tools/lib/traceevent/event-parse.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c > index 8e24c4c78c7f..69e4d5229362 100644 > --- a/tools/lib/traceevent/event-parse.c > +++ b/tools/lib/traceevent/event-parse.c > @@ -4507,8 +4507,10 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s > arg->next = NULL; > arg->type = TEP_PRINT_BSTRING; > arg->string.string = strdup(bptr); > - if (!arg->string.string) > + if (!arg->string.string) { > + free(arg); > goto out_free; This is a fix, thank you. But libtraceevent now lives here: https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ I'll port this patch to that. Thanks, -- Steve > + } > bptr += strlen(bptr) + 1; > *next = arg; > next = &arg->next;