]> git.eshelyaron.com Git - emacs.git/commitdiff
Free cwd when no longer needed
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Jun 2017 05:38:04 +0000 (22:38 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Jun 2017 05:38:32 +0000 (22:38 -0700)
* lib-src/emacsclient.c (main): Don’t dally when freeing cwd.

lib-src/emacsclient.c

index 3a0715f137e8c6fb0813b7e43d90bcba3baa0ec5..8828b7652de87ab95f8391d01d2f94011aa86d93 100644 (file)
@@ -208,7 +208,7 @@ char *get_current_dir_name (void);
 /* Return the current working directory.  Returns NULL on errors.
    Any other returned value must be freed with free.  This is used
    only when get_current_dir_name is not defined on the system.  */
-char*
+char *
 get_current_dir_name (void)
 {
   char *buf;
@@ -1702,6 +1702,7 @@ main (int argc, char **argv)
   if (tramp_prefix)
     quote_argument (emacs_socket, tramp_prefix);
   quote_argument (emacs_socket, cwd);
+  free (cwd);
   send_to_emacs (emacs_socket, "/");
   send_to_emacs (emacs_socket, " ");
 
@@ -1945,8 +1946,6 @@ main (int argc, char **argv)
   if (rl < 0)
     exit_status = EXIT_FAILURE;
 
-  free (cwd);                   /* Keep leak checkers happy.  */
-
   CLOSE_SOCKET (emacs_socket);
   return exit_status;
 }