From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cRqEHmxz+mjY2AQAWB0awg (envelope-from ) for ; Thu, 23 Oct 2025 14:26:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1761244012; bh=KNo+CDsRRppJD4y6HcLAEG32zac/m2wxWObzSCX6Les=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Zkq7muRnMgX5cPYNK0IJFosLyp7v7RYoO2cP9qFC2bUDyuAmfWo64J3rbPotmOEN+ jxByZWNh173N6vetlmiip9coHRc9FTL5jfrNlYZSjynEOD3GmucOzC6TNEheuCIYkj QA0O/RLVfKgXci7WXf2p+F+xog6ZaC5MF5WxqKBw= Received: by simark.ca (Postfix, from userid 112) id 776D81E0BC; Thu, 23 Oct 2025 14:26:52 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=qJYH1Z1x; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C27071E04C for ; Thu, 23 Oct 2025 14:26:51 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5452E385829B for ; Thu, 23 Oct 2025 18:26:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5452E385829B Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=qJYH1Z1x Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 4D4EA3858419 for ; Thu, 23 Oct 2025 18:26:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D4EA3858419 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4D4EA3858419 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761243978; cv=none; b=qtHf8F7PSTHwQJNY96QJ4kyFsIWSBTIZa8nw4kMgT6zbhDrjqiBIMGSWmPxTl43BHKD9GPD00wLFyUolGNGeI8g7i0maefGlLa15XSeFiZc5K2Y8lAwTm7UxAoTLT/g78Loc/Uv9EM/2WXDap1UGL+oUcAetljcZ91cM39sVEHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761243978; c=relaxed/simple; bh=KNo+CDsRRppJD4y6HcLAEG32zac/m2wxWObzSCX6Les=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=ged144kReDiLrMDf2EwuKlybkSOfpaG4DPsMq2eJb7U2E76lN0zDCjK3xYKVBJmFqp84RDkoHV4ZD3A1FbtVdoMruZ65PG6DpPkygf2rH+YhPJaCqMjKj2RQV5B5fIPxJnHvgU7mHX5vk2xaK7TTaX0WbKkPhJPQ9y6ldeW9HYo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4D4EA3858419 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1761243977; bh=KNo+CDsRRppJD4y6HcLAEG32zac/m2wxWObzSCX6Les=; h=Date:Subject:To:References:From:In-Reply-To:From; b=qJYH1Z1xXkQF6M7qOSUNElexgMBIpsiRT8myGDCrZspm2cw3G+XFCi37mcOcQolIN uDLXcBe2xG99nXyne2Dl98CL3+OZMqVChFgty2gjvgq6gE/9iC7YDCRc1XKDJSsXf9 HQzdlYe0jljZNub/yYYjFPG80O6Ry+guUJFMLNTU= Received: by simark.ca (Postfix) id BB7291E04C; Thu, 23 Oct 2025 14:26:17 -0400 (EDT) Message-ID: <4c83ffce-598b-4712-9b98-45728d52b4d0@simark.ca> Date: Thu, 23 Oct 2025 14:26:17 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] Two bug fixes in mdict_free To: Tom Tromey , gdb-patches@sourceware.org References: <20251023-mdict-free-v1-0-ad02b2bdd549@tromey.com> <20251023-mdict-free-v1-1-ad02b2bdd549@tromey.com> Content-Language: fr From: Simon Marchi In-Reply-To: <20251023-mdict-free-v1-1-ad02b2bdd549@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 10/23/25 1:17 PM, Tom Tromey wrote: > A heap-allocated multidictionary should be freed by calling > mdict_free. However, while this function does free the contents of > the dictionary, it neglects to free the dictionary itself. > > There's also a second bug, which is that if a multidictionary is > created with no dictionaries, gdb will crash on the first line of > mdict_free: > > enum dict_type type = mdict->dictionaries[0]->vector->type; > > So, this patch also adds the type to struct multidictionary, avoiding > this problem. Note that this does not increase the structure size on > x86-64, because the new member fits into the padding. I think you could just remove dict_vector::type and use multidictionary::type at the single spot where dict_vector::type is still used. Simon