From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 8F9DB3858C51 for ; Fri, 1 Jul 2022 19:45:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F9DB3858C51 Received: by mail-pg1-x52a.google.com with SMTP id v126so3274410pgv.11 for ; Fri, 01 Jul 2022 12:45:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B/hUqJycy/mqf495Onn0x8njg4X1YeLMgHIrq9xizik=; b=EIK6YaNPjPpmqHOl4bBQhLd5WzKPwu8eORTPJYcHMNZS9nEvYN3zOIgzDjaj7vDECj u088ph1iKCkijwq8kTyaCTsEBHOn67+ddXRrry4I3XVHneAjIxSwiwK4twJHGhlTegdt QM+wLPWKDfSKa6zhlmc/P56qTCpCFqYbIt4p8Zz2PxEIQ4pZeRKeEes9iZqt40yCLXAE hjxgkmmIkJ4IKZ6GiGzuifGLdeShLWsNxarZq78M6oi++mq/v6HH10EsUu9mNdnfvZr5 pxxcyxZ538VepMf4fZ37JJI5kDkVbAG6aAdhshOivlJRu9u25nERBQMbTCKwUxKkwFMb hF4g== X-Gm-Message-State: AJIora8aWGQZUnUVE578IziP7OUFRxHy+0QRYhFP3YY4nrOsj2qWJOJN TZqSXXHA2dwwag756Shp4yheH0KzJDfNM4ISluXDBO6f X-Google-Smtp-Source: AGRyM1teRf9my82ePVDWhoUDQWPrXWraMukdnzfvFeNdGSVRTum/P9AbpqkY0WyRcatjen4Kmdkp75jIvVhVCm0EKPk= X-Received: by 2002:a63:c15:0:b0:411:f92a:8ec7 with SMTP id b21-20020a630c15000000b00411f92a8ec7mr1555794pgl.86.1656704718430; Fri, 01 Jul 2022 12:45:18 -0700 (PDT) MIME-Version: 1.0 References: <01f502ff-5b51-86d3-ed54-646df7d22037@suse.com> <1041c98c-a2a4-af7d-5872-cded045f1a60@suse.com> In-Reply-To: <1041c98c-a2a4-af7d-5872-cded045f1a60@suse.com> From: "H.J. Lu" Date: Fri, 1 Jul 2022 12:44:42 -0700 Message-ID: Subject: Re: [PATCH 1/7] x86: don't leak sub-architecture accumulated strings To: Jan Beulich Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3018.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, 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 server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2022 19:45:21 -0000 On Fri, Jul 1, 2022 at 3:18 AM Jan Beulich wrote: > > On 01.07.2022 00:54, H.J. Lu wrote: > > On Thu, Jun 30, 2022 at 5:53 AM Jan Beulich wrote: > >> --- a/gas/config/tc-i386.c > >> +++ b/gas/config/tc-i386.c > >> @@ -2871,6 +2871,7 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED > >> check_cpu_arch_compatible (string, cpu_arch[j].flags); > >> > >> cpu_arch_name = cpu_arch[j].name; > >> + xfree (cpu_sub_arch_name); > >> cpu_sub_arch_name = NULL; > >> cpu_arch_flags = cpu_arch[j].flags; > >> if (flag_code == CODE_64BIT) > >> @@ -13406,6 +13407,7 @@ md_parse_option (int c, const char *arg) > >> continue; > >> > >> cpu_arch_name = cpu_arch[j].name; > >> + xfree (cpu_sub_arch_name); > >> cpu_sub_arch_name = NULL; > >> cpu_arch_flags = cpu_arch[j].flags; > >> cpu_arch_isa = cpu_arch[j].type; > >> @@ -14086,6 +14088,7 @@ i386_target_format (void) > >> { > >> static const i386_cpu_flags iamcu_flags = CPU_IAMCU_FLAGS; > >> cpu_arch_name = "iamcu"; > >> + xfree (cpu_sub_arch_name); > >> cpu_sub_arch_name = NULL; > >> cpu_arch_flags = iamcu_flags; > >> cpu_arch_isa = PROCESSOR_IAMCU; > >> > > > > Can we just use free? > > In principle yes, but I view using free() as inconsistent when the > allocation used xmalloc() or alike. These should pair, even if right > now xfree() simply aliases to free() - this could change down the > road, and then cause unnecessary code churn just to update all such > instances. > I don't think we will change xfree. Just use free directly. Thanks. -- H.J.