[PATCH 0/1] MR4462: winepath: Don't duplicate the NT path.
From: Alex Henrie <alexhenrie24(a)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; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4462
This merge request was closed by Alex Henrie. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4462
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. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4462#note_56473
participants (2)
-
Alex Henrie -
Alex Henrie (@alexhenrie)