From patchwork Tue Nov 11 00:59:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 3645 Received: (qmail 8125 invoked by alias); 11 Nov 2014 01:00:38 -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 8100 invoked by uid 89); 11 Nov 2014 01:00:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f51.google.com Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 11 Nov 2014 01:00:35 +0000 Received: by mail-pa0-f51.google.com with SMTP id kq14so9362629pab.24 for ; Mon, 10 Nov 2014 17:00:33 -0800 (PST) X-Received: by 10.70.137.42 with SMTP id qf10mr36274785pdb.100.1415667633258; Mon, 10 Nov 2014 17:00:33 -0800 (PST) Received: from seba.sebabeach.org.gmail.com (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id 3sm17643359pdv.47.2014.11.10.17.00.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Nov 2014 17:00:32 -0800 (PST) From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH] Fix memory leak in watch_main_source_file_lossage Date: Mon, 10 Nov 2014 16:59:40 -0800 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. I happened to notice this memory leak while hacking on buildsym.c. Regression tested on amd64-linux. 2014-11-10 Doug Evans * buildsym.c (watch_main_source_file_lossage): Fix memory leak. diff --git a/gdb/buildsym.c b/gdb/buildsym.c index ef7e809..5a4fa06 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1002,6 +1002,8 @@ watch_main_source_file_lossage (void) subfiles = mainsub_alias->next; else prev_mainsub_alias->next = mainsub_alias->next; + xfree (mainsub_alias->name); + xfree (mainsub_alias->dirname); xfree (mainsub_alias); } }