From 5d7ff4cda532a17ea6924f6dca9b647cd071c1d7 Mon Sep 17 00:00:00 2001 From: mbalmer Date: Thu, 11 May 2017 07:34:27 +0000 Subject: Avoid possible null pointer dereferencing. Fixes PR kern/52225. --- sys/modules/lua/lua.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sys/modules/lua/lua.c') 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 . @@ -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); -- cgit