From patchwork Sat Oct 29 04:52:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 12630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1185679wru; Fri, 28 Oct 2022 21:53:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kFYgknsZRBlXs1sKdYviiRV03xU7JqhMAQ/yKjCgC8zpQJHARpBhjLntCOVV0lqvVlJyW X-Received: by 2002:a17:907:2daa:b0:78d:4dca:43e with SMTP id gt42-20020a1709072daa00b0078d4dca043emr2428582ejc.134.1667019185336; Fri, 28 Oct 2022 21:53:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667019185; cv=none; d=google.com; s=arc-20160816; b=NTzlEu8tU8Cl8RJdCo4sxlCL6GIi6U15pgQyjsSNPHz+DqzYvzhOJjE79Wxp6JIi+f egFpS/RJReE+T7OMG2gNvjvowJu2Z16kYUfDqCeCSXUkT5qPwc+eeJj1OI6vzYliSCQo uvrvWHgxX7tSxMd1z/0d2mNGuQprAZNpSm8TWcl6bisatInnucx+bISm+2cSqN3Kpr/H uEOL4ji9RZRU0B4opR0VtINqdJ4VinOr6Zoz6Kop12RFvrh/7gl87FQZJs3lXF6tzAPR rcsfZdlpvhjtimfeQQiX04m+b0HaC9YhWQ0KhyhLYZdgizBx5FzF0KyENE8o/oyXYlFt DNCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=gUPFj5OfMI/meKQplxGxGwU1CMKjPHV2ykIUPbMAWtg=; b=NrsJQfsYyjRA7k//cuxi4L9i76/xIwx3mKLjzewbI2OUsh3qMU/fHZYVsbTxE4MCls gCQfWqVZGqnKtCGQXKz3efCzH1t4pQsrweuL46d4CcCOXLPHTZa2typ4OUT6tEFWN1lt TC60uBW85Jfj0CCPr3dFLKIXqsa6eVBhyWJcv+lZaOebb4cd2V2+jsrWnz3wwAo+n8oj g/L2do7f3ieNwX6dDuzwWPSAs6wiK5KcLqg/bLyVf8liE13Ff/wL56V6Buc0bZ6AKKNr bYd3MpMvuufPGshh+DZij2KQGrAUumHQxvCJE1cxJ4/hWUpOMpkyQs+1XX5kuO/8oL0F l7vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=sULwF4IQ; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id i16-20020a1709064fd000b00741d9a1e2dbsi660115ejw.1004.2022.10.28.21.53.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 21:53:05 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=sULwF4IQ; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 95EF03857816 for ; Sat, 29 Oct 2022 04:52:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95EF03857816 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667019177; bh=gUPFj5OfMI/meKQplxGxGwU1CMKjPHV2ykIUPbMAWtg=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=sULwF4IQM5C6x6eVr2HLVGfUcUZGRRn4bOG/Iwdhv0rs4YQ7zwAedRuKV52FLbGhy RgvWL3OdadAdSbrugehL5cQK3mFImQpx5U5gyvQgfGeTs5JPTB4hrB5UKYXMAVIDSY NpIuYt/LanAIwuKWqNWkdRd4dLU8dmZbCFjLw+sU= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id 55F5D38582B0 for ; Sat, 29 Oct 2022 04:52:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 55F5D38582B0 Received: by mail-pg1-x536.google.com with SMTP id 78so6462970pgb.13 for ; Fri, 28 Oct 2022 21:52:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gUPFj5OfMI/meKQplxGxGwU1CMKjPHV2ykIUPbMAWtg=; b=V/2tfmWMRS3aG85TArW3KVyaZ996y4miwk4y9D1eIPGwvCUemPkKghd8nohXjlcw9w yI4SCkwDxoiS4Miv95RIZHdXqKfkhbyUmKufyXeq5swIHkB60iDyseBP/yv03fbTJovK 3KAnF1epvb/rXbDBPzzv+pq1z0fnit55mHSmvJNL/vJsr9PFiKoTaDiyjhPHF2yfA5cT lJ1XRbOBc1FytycPA80Qy9ls1aMF3NDdjzjJwxNLdDZpdLnD4wpw9ft0WSLtWE2fSn/s K6SjA8Z3EwWef8axkncfXif4cjd8XtqP0077H8DwZvgnAZwlFPw+K8Yqsu3EKoKeVVte YTLg== X-Gm-Message-State: ACrzQf0BUvCb4svSfh7u254r7BwtMxWXRMK89rej6I6+5xYVH92fHP+3 fnZ8nkLkQyUqWluT7S5GYoHgiD2jaWI= X-Received: by 2002:a63:4383:0:b0:440:3e0d:b9ec with SMTP id q125-20020a634383000000b004403e0db9ecmr2749287pga.54.1667019167839; Fri, 28 Oct 2022 21:52:47 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:e93b:3bfb:5587:694b]) by smtp.gmail.com with ESMTPSA id n126-20020a622784000000b00562ef28aac6sm290749pfn.185.2022.10.28.21.52.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 21:52:47 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 112E311424AE; Sat, 29 Oct 2022 15:22:45 +1030 (ACDT) Date: Sat, 29 Oct 2022 15:22:45 +1030 To: binutils@sourceware.org Subject: Fix small objcopy memory leak Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3035.6 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 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-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747996309167672469?= X-GMAIL-MSGID: =?utf-8?q?1747996309167672469?= * objcopy.c (copy_archive): Free l->name. diff --git a/binutils/objcopy.c b/binutils/objcopy.c index d20aaef9f4f..03350babb69 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -3744,6 +3744,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, bfd_close (l->obfd); unlink (l->name); } + free ((char *) l->name); next = l->next; free (l); }