summaryrefslogtreecommitdiffstats
path: root/player/lua.c
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2020-03-22 23:45:06 +0200
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2020-03-22 23:49:51 +0200
commit5a2fa3f29a7194df7e30ab45e3f4c3c640d017ef (patch)
tree90e3febf3255028ffc8d08777a21d620fe66b730 /player/lua.c
parent8deffd9fbbf49e8d1f72fd8ae69034e409de3e91 (diff)
downloadmpv-5a2fa3f29a7194df7e30ab45e3f4c3c640d017ef.tar.bz2
mpv-5a2fa3f29a7194df7e30ab45e3f4c3c640d017ef.tar.xz
lua: readdir: fix double closedir, use one more autofree
The double closedir is a regression from the previous commit, which also forgot to use the autofree context with the fullpath string.
Diffstat (limited to 'player/lua.c')
-rw-r--r--player/lua.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/player/lua.c b/player/lua.c
index 833605689e..f20e2a8084 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -1019,7 +1019,7 @@ static int script_readdir(lua_State *L, void *tmp)
}
add_af_dir(tmp, dir);
lua_newtable(L); // list
- char *fullpath = NULL;
+ char *fullpath = talloc_strdup(tmp, "");
struct dirent *e;
int n = 0;
while ((e = readdir(dir))) {
@@ -1041,8 +1041,6 @@ static int script_readdir(lua_State *L, void *tmp)
lua_pushstring(L, name); // list index name
lua_settable(L, -3); // list
}
- closedir(dir);
- talloc_free(fullpath);
return 1;
}