From patchwork Sat Nov 24 11:52:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 30277 Received: (qmail 79903 invoked by alias); 24 Nov 2018 11:52:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 79890 invoked by uid 89); 24 Nov 2018 11:52:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=transfer, HContent-Transfer-Encoding:8bit X-HELO: mailsec112.isp.belgacom.be Received: from mailsec112.isp.belgacom.be (HELO mailsec112.isp.belgacom.be) (195.238.20.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 24 Nov 2018 11:52:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1543060366; x=1574596366; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=y+ub4/JQSjUzQD2oDZ4GCYHS2e9iAlysxpiAfdoDofo=; b=a9AWhsp96UnIP4sOadoYJlT8ggcghArbWx1qFj+CZ1EXGr+2xIhqw7Lw luGOVG8TrU8SsEP3y7G+melJGSZbsA==; Received: from 184.205-67-87.adsl-dyn.isp.belgacom.be (HELO md.home) ([87.67.205.184]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 24 Nov 2018 12:52:43 +0100 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [PUSHED/OBVIOUS] Re-fix leak in source.c (open_source_file). Date: Sat, 24 Nov 2018 12:52:37 +0100 Message-Id: <20181124115237.8943-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes Leak fixed in '8e6a5953e1d Fix 4K leak in open_source_file' has been partially undone by '2179fbc36d23 Return scoped_fd from open_source_file'. Re-add the transfer of current s->fullname to the unique_xmalloc_ptr fullname given to find_and_open_source. --- gdb/ChangeLog | 8 ++++++++ gdb/source.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 90e8d7a5c6..2515a4d0b8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2018-11-24 Philippe Waroquiers + + * source.c (open_source_file): Leak fixed in '8e6a5953e1d Fix 4K + leak in open_source_file' has been partially undone by '2179fbc36d23 + Return scoped_fd from open_source_file'. Re-add the transfer of + current s->fullname to the unique_xmalloc_ptr fullname given + to find_and_open_source. + 2018-11-23 Pedro Alves * gdbthread.h (enum thread_state): Move comments here. diff --git a/gdb/source.c b/gdb/source.c index b38eed5be6..e295fbf49e 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1068,7 +1068,7 @@ open_source_file (struct symtab *s) if (!s) return scoped_fd (-1); - gdb::unique_xmalloc_ptr fullname; + gdb::unique_xmalloc_ptr fullname (s->fullname); s->fullname = NULL; scoped_fd fd = find_and_open_source (s->filename, SYMTAB_DIRNAME (s), &fullname);