From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8AB97385802E; Thu, 4 Aug 2022 14:30:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8AB97385802E From: "mark at klomp dot org" To: elfutils-devel@sourceware.org Subject: [Bug libdw/29434] Memory leak in `dwarf_getscopes` Date: Thu, 04 Aug 2022 14:30:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: libdw X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mark at klomp dot org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mark at klomp dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to everconfirmed bug_status cf_reconfirmed_on cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2022 14:30:11 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29434 Mark Wielaard changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at sourceware dot org |mark at klomp dot o= rg Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2022-08-04 CC| |mark at klomp dot org --- Comment #1 from Mark Wielaard --- Thanks. That seems correct. If in the first visit a.scopes was allocated, b= ut an error occurs later or in the second visit a.scopes isn't freed. Except in the case of a realloc failure. It would make sense to also not dealloc in t= hat failure case so we can always free on failure before we return the error as= you suggest. BTW. Do you know what why result was negative (I assume it was negative, it could in theory also be zero, but that would be surprising if that would ca= use the leak)? --=20 You are receiving this mail because: You are on the CC list for the bug.=