Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp827721iog; Fri, 17 Jun 2022 14:50:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vC8nr0NqXzL7sswIT4/XUocQpwtN4Rwyxe7WRCA4cBdT2q6bqXLDT1+MLgYmKmMA/uzKa1 X-Received: by 2002:aa7:c150:0:b0:435:67cd:5115 with SMTP id r16-20020aa7c150000000b0043567cd5115mr3475447edp.112.1655502615496; Fri, 17 Jun 2022 14:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655502615; cv=none; d=google.com; s=arc-20160816; b=vLjz9yJ/EpTh6EaWWkWBjLo47spexQSPZO8gG8j0ADioT06LGw2e7X+RF0yH9RvK4+ F+FHa2CpA0pf37TS61yqY++rYFGhm15vYngQA02uJ9Cb0YbMCkfKnSPRYN5uZBKmVWvT AHJde2Y9Mrc1uE76xNTB40uqWxIWefrAMrz++q7xVI+Enu/heYpdvNPmGxWchlmr8gXf P+9Xt0mdGfcM+rYLw0em4I+SQdVVmtK1Zo8CUYpvaTGexkD2brQjJK3kemU+BbJ935z7 Fr/i6TPO+XYxIJwfjq/qyTu9pbZRU83x758AEmDP0Mdsnq5wpCTP+0VfQpLH2OoKO/oM 33vg== 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=fFbVC6AXX6gCa5SPmXfVdL3TZ6BElpbc6r/XpyLb9fk=; b=DJG4g7QbeYLGfaEiQboHtZHh3/wxhICHFvsnyjmYRR8nQu+7pZd48e5+zW1ICXa3a/ Mmc92zXwIPcvoaPJpG6jySwypduyt7jgyTzcxs/cBGwk8mtAs4EDxF9esYDxsRHPLC0P jRt3w72h7260QhCY3ETLJVaXDTnPKfC0l3cMflVcu/3c52z7LsbATFDjnOJE9WNuklVL ApZX8zWuo884n6b3wmL0DlJZuWAUoF41cCMI0EEAxh8/Oz5NeRWv+200c7obJs5gE/Bx xplUOfVteXuMvG/PGl8re5E5L+RwoA6AWzN9EDiglFtjEgjOAtWq1nIeBw4Kwoo7b+5q CANA== 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 hp11-20020a1709073e0b00b006feb76dbd51si6349237ejc.289.2022.06.17.14.49.50; Fri, 17 Jun 2022 14:50:15 -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 S236588AbiFQVoh (ORCPT + 99 others); Fri, 17 Jun 2022 17:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235817AbiFQVoT (ORCPT ); Fri, 17 Jun 2022 17:44:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67D265402F for ; Fri, 17 Jun 2022 14:44:18 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 019B5620C6 for ; Fri, 17 Jun 2022 21:44:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A3D7C3411B; Fri, 17 Jun 2022 21:44:16 +0000 (UTC) Date: Fri, 17 Jun 2022 17:44:14 -0400 From: Steven Rostedt To: Wang ShaoBo Cc: , , , , , Subject: Re: [PATCH 2/2] libtraceevent: fix free NULL pointer in parse_arg_add() Message-ID: <20220617174414.495392e2@gandalf.local.home> In-Reply-To: <20220513023308.2400381-3-bobo.shaobowang@huawei.com> References: <20220513023308.2400381-1-bobo.shaobowang@huawei.com> <20220513023308.2400381-3-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:08 +0800 Wang ShaoBo wrote: > Should not call free if parg->format is NULL. > > Fixes: e7a90882b05b ("tools lib traceevent: Optimize pretty_print() function") > 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 69e4d5229362..b1a07db54457 100644 > --- a/tools/lib/traceevent/event-parse.c > +++ b/tools/lib/traceevent/event-parse.c > @@ -5461,9 +5461,11 @@ static int parse_arg_add(struct tep_print_parse **parse, char *format, > return 0; > error: > if (parg) { > - free(parg->format); > + if (parg->format) > + free(parg->format); It's perfectly fine to call free(NULL). This is not a bug fix. -- Steve > free(parg); > } > + > return -1; > } >