summaryrefslogtreecommitdiffstats
path: root/osdep/path-win.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:13:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:13:14 +0000
commit5a3b54c78ce63d899f76dbb3db72e4894b40bd53 (patch)
tree50693d13eeefc4d683bdf5417f0861b0ef274a0c /osdep/path-win.c
parentAdding debian version 0.37.0-1. (diff)
downloadmpv-5a3b54c78ce63d899f76dbb3db72e4894b40bd53.tar.xz
mpv-5a3b54c78ce63d899f76dbb3db72e4894b40bd53.zip
Merging upstream version 0.38.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--osdep/path-win.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/osdep/path-win.c b/osdep/path-win.c
index bddf5a5..3b104ca 100644
--- a/osdep/path-win.c
+++ b/osdep/path-win.c
@@ -24,17 +24,15 @@
#include "osdep/path.h"
#include "osdep/threads.h"
-// Warning: do not use PATH_MAX. Cygwin messed it up.
-
static mp_once path_init_once = MP_STATIC_ONCE_INITIALIZER;
static char *portable_path;
static char *mp_get_win_exe_dir(void *talloc_ctx)
{
- wchar_t w_exedir[MAX_PATH + 1] = {0};
+ wchar_t *w_exedir = talloc_array(NULL, wchar_t, MP_PATH_MAX);
- int len = (int)GetModuleFileNameW(NULL, w_exedir, MAX_PATH);
+ int len = (int)GetModuleFileNameW(NULL, w_exedir, MP_PATH_MAX);
int imax = 0;
for (int i = 0; i < len; i++) {
if (w_exedir[i] == '\\') {
@@ -42,10 +40,11 @@ static char *mp_get_win_exe_dir(void *talloc_ctx)
imax = i;
}
}
-
w_exedir[imax] = '\0';
- return mp_to_utf8(talloc_ctx, w_exedir);
+ char *ret = mp_to_utf8(talloc_ctx, w_exedir);
+ talloc_free(w_exedir);
+ return ret;
}
static char *mp_get_win_exe_subdir(void *ta_ctx, const char *name)