diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 43dee06649..1807847cff 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -3466,8 +3466,7 @@ arg_heuristic_with_exclusions (char const * const arg, char const * exclusions, { return ((char *)arg); } - arg_result = (char *)malloc (strlen (stack_path)+1); - strcpy (arg_result, stack_path); + arg_result = (char *)realloc (stack_path, strlen (stack_path)+1); // Windows doesn't like empty entries in PATH env. variables (;;) char* semisemi = strstr(arg_result, ";;"); while (semisemi)