From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id 6662D3858413 for ; Mon, 20 Jun 2022 01:50:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6662D3858413 Received: by mail-pg1-x531.google.com with SMTP id s185so3236261pgs.3 for ; Sun, 19 Jun 2022 18:50:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=8LUuO5FWgLpFKK5n9PSHlzdoscqnIsjxo48sSq3ZxQg=; b=1IChcAp9cAilWbhsNiLGh+XAV8G6kQbxS0pwgqX7rEzbUNESAVvgW1JwqXod5Us0MO 0VTsnUAfeYjlisWLOxQLRKucjoB5dRYk9LfK2tlXopdtQ79S9utZVnZryop3krjNnBps 1WDb2P8lBpt2fqi6Wfq5oDL3h8fAzEocxREyr1Qo4hVoTwNs5a2pbrrQHRZKrF7PmXLb HiB3eUnhO3lufys9o4FjjUCnEMj3ywMry+fsE+SEdDjK1zkdoVUrAXiKtbL/WJYLTdYy Lu5Q/huVADin/4P716Akmwf+TrvFpaIT5ZuuFsYBsFYnGetEQheyAuVtK6MwrdweoUuw TWBg== X-Gm-Message-State: AJIora/DU2WcvHMaK2lKuvZsnyZ+ggJoSxXrxufcQulk7djgEP86JcQK hzac7CL4xdRNbxMZdrjI8t4SSXJTzmI= X-Google-Smtp-Source: AGRyM1urh4u8hwMdWrLyKn1e1klCUTf+SG+CtjK7P+1mx98P/cu1iEks9zSoBHhu6NvON2+eiDXZwA== X-Received: by 2002:a62:b515:0:b0:50a:3d51:671e with SMTP id y21-20020a62b515000000b0050a3d51671emr22153058pfe.48.1655689834083; Sun, 19 Jun 2022 18:50:34 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id j3-20020a170903024300b001624965d83bsm7345564plh.228.2022.06.19.18.50.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 18:50:33 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 8973C1140364; Mon, 20 Jun 2022 11:20:30 +0930 (ACST) Date: Mon, 20 Jun 2022 11:20:30 +0930 From: Alan Modra To: binutils@sourceware.org Subject: PR29261, memory leak in parse_stab_struct_fields Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3037.0 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, 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: Mon, 20 Jun 2022 01:50:37 -0000 PR 29261 * stabs.c (parse_stab_struct_fields): Free "fields" on failure path. diff --git a/binutils/stabs.c b/binutils/stabs.c index 796ff85b86a..bf3f578cbcc 100644 --- a/binutils/stabs.c +++ b/binutils/stabs.c @@ -2367,7 +2367,10 @@ parse_stab_struct_fields (void *dhandle, if (! parse_stab_one_struct_field (dhandle, info, pp, p, fields + c, staticsp, p_end)) - return false; + { + free (fields); + return false; + } ++c; } -- Alan Modra Australia Development Lab, IBM