+2017-06-19  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+       * mi/mi-cm-env.c (_initialize_mi_cmd_env): Use getenv instead of
+       gdb_environ to access an environment variable.
+
 2017-06-18  Thomas Petazzoni  <thomas.petazzoni@free-electrons.com>
 
        * nat/linux-ptrace.c (linux_fork_to_function): Add cast to
 
 void 
 _initialize_mi_cmd_env (void)
 {
-  struct gdb_environ *environment;
   const char *env;
 
   /* We want original execution path to reset to, if desired later.
      At this point, current inferior is not created, so cannot use
-     current_inferior ()->environment.  Also, there's no obvious
-     place where this code can be moved such that it surely run
-     before any code possibly mangles original PATH.  */
-  environment = make_environ ();
-  init_environ (environment);
-  env = get_in_environ (environment, path_var_name);
+     current_inferior ()->environment.  We use getenv here because it
+     is not necessary to create a whole new gdb_environ just for one
+     variable.  */
+  env = getenv (path_var_name);
 
   /* Can be null if path is not set.  */
   if (!env)
     env = "";
   orig_path = xstrdup (env);
-  free_environ (environment);
 }