all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Anders Waldenborg <anders@0x63.nu>
To: 26628@debbugs.gnu.org
Subject: bug#26628: [PATCH] Fix memory leak of cwd string in emacsclient
Date: Sun, 23 Apr 2017 21:23:13 +0200	[thread overview]
Message-ID: <CADsOX3CMeH-xQd3zRS6k0x=bQeAbbHau=4ruDmk2Xz3CtGzeNA@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 60 bytes --]

The attached patch fixes a tiny memory leak in emacsclient.

[-- Attachment #1.2: Type: text/html, Size: 111 bytes --]

[-- Attachment #2: 0001-Fix-memory-leak-of-cwd-string-in-emacsclient.patch --]
[-- Type: text/x-patch, Size: 815 bytes --]

From a673aceab4eb0bcfa4e6ff34c02adc453383805b Mon Sep 17 00:00:00 2001
From: Anders Waldenborg <anders@0x63.nu>
Date: Sun, 23 Apr 2017 21:15:46 +0200
Subject: [PATCH] Fix memory leak of cwd string in emacsclient

* 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.
---
 lib-src/emacsclient.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index c22b308..3ffb9ea 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1901,6 +1901,8 @@ main (int argc, char **argv)
   if (rl < 0)
     exit_status = EXIT_FAILURE;
 
+  free (cwd);
+
   CLOSE_SOCKET (emacs_socket);
   return exit_status;
 }
-- 
2.7.4


             reply	other threads:[~2017-04-23 19:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-23 19:23 Anders Waldenborg [this message]
2017-04-24  9:23 ` bug#26628: [PATCH] Fix memory leak of cwd string in emacsclient Andreas Schwab
2017-04-24 16:05   ` Anders Waldenborg
2017-06-01  2:59   ` npostavs
2017-06-01  6:30 ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADsOX3CMeH-xQd3zRS6k0x=bQeAbbHau=4ruDmk2Xz3CtGzeNA@mail.gmail.com' \
    --to=anders@0x63.nu \
    --cc=26628@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.