summaryrefslogtreecommitdiff
path: root/sys/modules/lua/lua.c
diff options
context:
space:
mode:
authormbalmer <mbalmer@NetBSD.org>2017-05-11 07:34:27 +0000
committermbalmer <mbalmer@NetBSD.org>2017-05-11 07:34:27 +0000
commit5d7ff4cda532a17ea6924f6dca9b647cd071c1d7 (patch)
treee490b9edc1e972d55e403d84aaa791ea88bfd755 /sys/modules/lua/lua.c
parentdb192593caa71a6594fc904155fa2283cf3e3323 (diff)
Avoid possible null pointer dereferencing.
Fixes PR kern/52225.
Diffstat (limited to 'sys/modules/lua/lua.c')
-rw-r--r--sys/modules/lua/lua.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/modules/lua/lua.c b/sys/modules/lua/lua.c
index 37a32a59700..14e90ba7d5b 100644
--- a/sys/modules/lua/lua.c
+++ b/sys/modules/lua/lua.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lua.c,v 1.20 2017/04/16 17:45:12 riastradh Exp $ */
+/* $NetBSD: lua.c,v 1.21 2017/05/11 07:34:27 mbalmer Exp $ */
/*
* Copyright (c) 2014 by Lourival Vieira Neto <lneto@NetBSD.org>.
@@ -335,10 +335,12 @@ luaioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
}
K = kluaL_newstate(create->name, create->desc, IPL_NONE);
- K->ks_user = true;
if (K == NULL)
return ENOMEM;
+
+ K->ks_user = true;
+
if (lua_verbose)
device_printf(sc->sc_dev, "state %s created\n",
create->name);