From: Alex Henrie alexhenrie24@gmail.com
--- programs/winepath/winepath.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/programs/winepath/winepath.c b/programs/winepath/winepath.c index 9a322f40937..8d13919fe30 100644 --- a/programs/winepath/winepath.c +++ b/programs/winepath/winepath.c @@ -193,11 +193,8 @@ int __cdecl wmain(int argc, WCHAR *argv[]) printf("%s%c", path, separator); } if (outputformats & UNIXFORMAT) { - WCHAR *ntpath, *tail; - int ntpathlen=lstrlenW(argv[i]); - ntpath = malloc(sizeof(*ntpath)*(ntpathlen+1)); - lstrcpyW(ntpath, argv[i]); - tail=NULL; + WCHAR *ntpath = argv[i], *tail = NULL; + int ntpathlen = wcslen(ntpath); while (1) { char *unix_name; @@ -247,7 +244,6 @@ int __cdecl wmain(int argc, WCHAR *argv[]) tail=slash; *tail='\0'; } - free(ntpath); } if (outputformats & WINDOWSFORMAT) { WCHAR* windows_name;
This merge request was closed by Alex Henrie.
It looks like it actually is important to duplicate `argv[i]` because it's copied to `slash`, then to `tail`, then overwritten, then used again with the expectation that it has not been modified. Therefore I am closing this merge request.