From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 3B1B53857C50; Thu, 20 Aug 2020 22:26:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3B1B53857C50 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: EY1Un4aQrA8hDlF/OCKL/6ZUkP1z4XjpDRncOgMrFfy3OHTSp7aG8NLsAVrL4NN3S9wh+3vqbY xGRkhZjUZ8o7Yh4rrW+ggC7qC6Ck+CYULxlfDEs0QEVhXY8Lhm2xuLSVaDjTOIjG68RBmUQTYD ZL6EyiU/24oy0jjWnwcpzAxER88GLItBj4CwjYqnPABtzHTysBeytDtWPePnoxdBo2dbRPbptX +ri5JH093beebByDpnEDXZL7sqHlTf+O9zLH5ElNpbrBD711WE1MVFxjlGE7SFAnrL218w47TY q4c= X-IronPort-AV: E=Sophos;i="5.76,334,1592899200"; d="scan'208";a="54301250" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 20 Aug 2020 14:26:26 -0800 IronPort-SDR: Eva03KumXx+Nq6RtdsEmlnP1n4ZXEg/O/3SU/CYMBh7AUN7stIj3b7DszgzecbDQLDcdhxiv1Q JwATPG08oSfQBJ6LsylnNz0ozkrEym5FJm6nKQ5Yind3UXuR1gZm7EB/IKKHWa1DHA8zniJ37z zLsNF2UW51rg3V4i6+rjmAZ4rSlbHwx7DGjMCCxYk2qh0spTWUpFehFWZCxL79fUpel/m3KfWx 6Pj/r8Qu6tkk9WtvefSQknI/oKnKGwxlECcb9Ebvdf6HJh0pABdrLgKUVRY06szzVOhwbQe6Jv OCE= Date: Thu, 20 Aug 2020 22:26:20 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Alex Coplan CC: , , Subject: Re: [PATCH] libgccjit: Fix several memory leaks in the driver In-Reply-To: <20200709201308.ngxjyakuxapc4yti@arm.com> Message-ID: References: <20200709201308.ngxjyakuxapc4yti@arm.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) X-Spam-Status: No, score=-3127.8 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: jit@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Jit mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2020 22:26:29 -0000 On Thu, 9 Jul 2020, Alex Coplan wrote: > 2020-07-09 Alex Coplan > > * gcc.c (set_static_spec): New. > (set_static_spec_owned): New. > (set_static_spec_shared): New. > (driver::maybe_putenv_COLLECT_LTO_WRAPPER): Use > set_static_spec_owned() to take ownership of lto_wrapper_file > such that it gets freed in driver::finalize. > (driver::maybe_run_linker): Use set_static_spec_shared() to > ensure that we don't try and free() the static string "ld", > also ensuring that any previously-allocated string in > linker_name_spec is freed. Likewise with argv0. > (driver::finalize): Use set_static_spec_shared() when resetting > specs that previously had allocated strings; remove if(0) > around call to free(). OK with a comment added to set_static_spec, documenting the semantics of the function and its arguments. -- Joseph S. Myers joseph@codesourcery.com