From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id C18FD3857016 for ; Thu, 6 Apr 2023 12:00:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C18FD3857016 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1035.google.com with SMTP id r7-20020a17090b050700b002404be7920aso38590750pjz.5 for ; Thu, 06 Apr 2023 05:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680782407; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=8uPoubcNGYigvITKkRZezgVa1yUf2GE11uJBbb3vwdE=; b=H9T1sp1q4AhOxcKQZqYLdPD+dwMe7QY/o0No2SwSgJpnAnojV0qC93+UF20RBJp5oO EZwLGNby0Q2HJANXhf8DpChxikTImGswEsvmN07yDddKemrPd0Dyf5HYa7L9vQ2uEU3s uGged81tfz8HPcZdMnqv8v7ODwsf9jHvGBJihdG19zrN0KALqWnNKc688vAsOE3DXwvb HybHnBltGfRhyNfdYwg23FJ6v0J37aJWDrvYAkUKIG/KustgSsJfS3GVcEiyHCERX6Hj MTX2iAnDh6nXB1ThN2AhgbInz5MbHHxJYxaEnTAYzCXZMBBfxO1Dy9zJ2ndO+MpvE5Pm 57UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680782407; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8uPoubcNGYigvITKkRZezgVa1yUf2GE11uJBbb3vwdE=; b=S7yhQumxnuP39zS8G/vEzwKJXfUpOLR4xOX/JLqHLjbCedey9evor2sbzbAzQzfS78 vgzxicMPnMJ3XrExEB5pQ98oOMBpVceU7LOiGgOkqY6s5UiWknUeCo1fu6EuKlBuXA+E KndzVxOWRYqLPumoVHrGFOCTxihyGTqA7FpK/6YQeI5KL9Mpl/2pZNCJsR2YE8VtKMoy lC8Tm7lIediBDycP6JYIfnP3YAZwvBhFdNBmGXceC9RPhz3b4m1sj2psDj9iYhObJacW GrrzKT7PO3Zbw9daRn7ArzCi6Fzry6g1K8Alq/7cEAO3BMWOTQr5tuDsUOUvdwg0D9Qr qFxA== X-Gm-Message-State: AAQBX9eXdZ5cwBNkNYqPYiDOuG3lCGb31UmGBrfce/vlJGex7fgj0Bss SWVcC12bdw0/t2aF7RCT6zJLdw4LFIc= X-Google-Smtp-Source: AKy350ZLHK8V3A1QCbrc4hkPmneUsM1095XxS+osIB8VeVtT/JohUmObutpTyHjXRwQZYvZJAnN4gw== X-Received: by 2002:a17:903:52:b0:1a1:bb4e:4eb8 with SMTP id l18-20020a170903005200b001a1bb4e4eb8mr8039081pla.62.1680782407166; Thu, 06 Apr 2023 05:00:07 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:e60c:bee0:cfeb:3a6]) by smtp.gmail.com with ESMTPSA id nh12-20020a17090b364c00b0023d16f05dd8sm1046870pjb.36.2023.04.06.05.00.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 05:00:05 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id BC05D1142C3C; Thu, 6 Apr 2023 21:30:01 +0930 (ACST) Date: Thu, 6 Apr 2023 21:30:01 +0930 From: Alan Modra To: binutils@sourceware.org Subject: Re: objcopy write_debugging_info memory leaks Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3034.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Oops, tried to free too much * wrstabs.c (write_stabs_in_sections_debugging_info): Don't free strings. diff --git a/binutils/wrstabs.c b/binutils/wrstabs.c index b676374558b..234a96f98a3 100644 --- a/binutils/wrstabs.c +++ b/binutils/wrstabs.c @@ -464,7 +464,7 @@ write_stabs_in_sections_debugging_info (bfd *abfd, void *dhandle, bfd_size_type *pstringsize) { struct stab_write_handle info; - struct string_hash_entry *h, *hnext; + struct string_hash_entry *h; bfd_byte *p; bool ret; @@ -535,11 +535,6 @@ write_stabs_in_sections_debugging_info (bfd *abfd, void *dhandle, free (info.symbols); ret = false; out: - for (h = info.strings; h != NULL; h = hnext) - { - hnext = h->next; - free (h); - } while (info.type_stack != NULL) { struct stab_type_stack *s = info.type_stack; -- Alan Modra Australia Development Lab, IBM