aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/wslua_dir.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2017-12-15 19:26:00 +0100
committerMichael Mann <mmann78@netscape.net>2017-12-16 04:03:41 +0000
commit3d086e638dc0a1713328c23161671555dfa4faaf (patch)
tree5c5759ee951d15f963b6025c4c2d86b33b77adb9 /epan/wslua/wslua_dir.c
parent621077309506ec65cb99b4f3aeffb99bcba69393 (diff)
wslua: Fix crash in Dir.open()
Do not give an uninitialised error pointer to g_dir_open(), this will give a crash if g_dir_open() fails. Remove wslua_dir.dummy because it is not used by anyone. Change-Id: I044eee021393f2ea2aa022138bbf6fd099eb0908 Reviewed-on: https://code.wireshark.org/review/24840 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/wslua/wslua_dir.c')
-rw-r--r--epan/wslua/wslua_dir.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/epan/wslua/wslua_dir.c b/epan/wslua/wslua_dir.c
index 5c12ca1353..483fe1da53 100644
--- a/epan/wslua/wslua_dir.c
+++ b/epan/wslua/wslua_dir.c
@@ -208,20 +208,18 @@ WSLUA_CONSTRUCTOR Dir_open(lua_State* L) {
}
dir = (Dir)g_malloc(sizeof(struct _wslua_dir));
- dir->dir = g_dir_open(dirname_clean, 0, dir->dummy);
+ dir->dir = g_dir_open(dirname_clean, 0, NULL);
g_free(dirname_clean);
- dir->ext = g_strdup(extension);
- dir->dummy = (GError **)g_malloc(sizeof(GError *));
- *(dir->dummy) = NULL;
if (dir->dir == NULL) {
- g_free(dir->dummy);
g_free(dir);
WSLUA_ARG_ERROR(Dir_open,PATHNAME,"could not open directory");
return 0;
}
+ dir->ext = g_strdup(extension);
+
pushDir(L,dir);
WSLUA_RETURN(1); /* the `Dir` object. */
}
@@ -347,7 +345,6 @@ static int Dir__gc(lua_State* L) {
g_dir_close(dir->dir);
}
- g_free(dir->dummy);
g_free(dir->ext);
g_free(dir);