Subject: [PATCH] Fix memory leak of cwd string in emacsclient

From: Anders Waldenborg <[email-masked]>
Date: Sun, 23 Apr 2017 21:23:13 +0200

The attached patch fixes a tiny memory leak in emacsclient.
From a673aceab4eb0bcfa4e6ff34c02adc453383805b Mon Sep 17 00:00:00 2001
From: Anders Waldenborg <[email-masked]>
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