From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Anders Waldenborg Newsgroups: gmane.emacs.bugs Subject: bug#26628: [PATCH] Fix memory leak of cwd string in emacsclient Date: Mon, 24 Apr 2017 18:05:51 +0200 Message-ID: <20170424160551.GA4913@gagarin.0x63.nu> References: <87zif6dur5.fsf@linux-m68k.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1493050118 21446 195.159.176.226 (24 Apr 2017 16:08:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 24 Apr 2017 16:08:38 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) Cc: 26628@debbugs.gnu.org To: Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 24 18:08:33 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d2gXR-0005SL-0M for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Apr 2017 18:08:33 +0200 Original-Received: from localhost ([::1]:44980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2gXW-0000Rd-Qj for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Apr 2017 12:08:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2gW4-0007Z6-8R for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2017 12:07:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2gVy-0002uP-Ma for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2017 12:07:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39991) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d2gVy-0002uD-IO for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2017 12:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d2gVy-0004NS-DQ for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2017 12:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Anders Waldenborg Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Apr 2017 16:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26628 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 26628-submit@debbugs.gnu.org id=B26628.149304996216735 (code B ref 26628); Mon, 24 Apr 2017 16:07:02 +0000 Original-Received: (at 26628) by debbugs.gnu.org; 24 Apr 2017 16:06:02 +0000 Original-Received: from localhost ([127.0.0.1]:38188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d2gUz-0004Lm-Vo for submit@debbugs.gnu.org; Mon, 24 Apr 2017 12:06:02 -0400 Original-Received: from 0x63.nu ([109.74.10.199]:54781 helo=gagarin.0x63.nu ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d2gUx-0004LX-S8 for 26628@debbugs.gnu.org; Mon, 24 Apr 2017 12:06:00 -0400 Original-Received: from andersg by gagarin.0x63.nu with local (Exim 4.80) (envelope-from ) id 1d2gUp-0001aE-IQ; Mon, 24 Apr 2017 18:05:51 +0200 Content-Disposition: inline In-Reply-To: <87zif6dur5.fsf@linux-m68k.org> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: andersg@gagarin.0x63.nu X-SA-Exim-Scanned: No (on gagarin.0x63.nu); SAEximRunCond expanded to false X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:131939 Archived-At: On Mon, Apr 24, 2017 at 11:23:26AM +0200, Andreas Schwab wrote: > > * lib-src/emacsclient.c (main): emacsclient retrieves the current > > working directory using get_current_dir_name which returns a newly > > allocated string. Make sure this string is freed before exiting. > > There is no need to free it since the process exists right away anyway. Yes. Unless you compile with -fsanitize=address and this leak makes emacsclient mostly unusable as the asan leak checker will change the return code to non-zero (yes I'm aware that I can set ASAN_OPTIONS=detect_leaks=0 in the environment). anders