From 6479646f418c943a0488b4569709fb95ae318376 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 5 Apr 2021 22:34:14 +0200 Subject: player/scripting: fix use-after-free when loading script folders --- player/scripting.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'player') diff --git a/player/scripting.c b/player/scripting.c index 24e2931539..3db879778c 100644 --- a/player/scripting.c +++ b/player/scripting.c @@ -174,9 +174,10 @@ static int64_t mp_load_script(struct MPContext *mpctx, const char *fname) }; talloc_free(tmp); + fname = NULL; // might have been freed so don't touch anymore if (!arg->client) { - MP_ERR(mpctx, "Failed to create client for script: %s\n", fname); + MP_ERR(mpctx, "Failed to create client for script: %s\n", arg->filename); talloc_free(arg); return -1; } @@ -185,7 +186,7 @@ static int64_t mp_load_script(struct MPContext *mpctx, const char *fname) arg->log = mp_client_get_log(arg->client); int64_t id = mpv_client_id(arg->client); - MP_DBG(arg, "Loading %s %s...\n", backend->name, fname); + MP_DBG(arg, "Loading %s %s...\n", backend->name, arg->filename); if (backend->no_thread) { run_script(arg); -- cgit v1.2.3