summaryrefslogtreecommitdiff
path: root/sys/modules/lua/lua.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2015-02-07 04:09:13 +0000
committerchristos <christos@NetBSD.org>2015-02-07 04:09:13 +0000
commit3ab86cd12adaa0ba9d0e59d5032a9547782bae83 (patch)
tree3197e966999b2335f5dac13da4c0448876879e64 /sys/modules/lua/lua.c
parent8bc3dca0a89fe34a56811cec1d9207f1b07b6aa7 (diff)
plug leak on error. Reported by:
http://www.m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-4
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 26efb830044..7f69436910e 100644
--- a/sys/modules/lua/lua.c
+++ b/sys/modules/lua/lua.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lua.c,v 1.15 2014/11/30 19:15:03 lneto Exp $ */
+/* $NetBSD: lua.c,v 1.16 2015/02/07 04:09:13 christos Exp $ */
/*
* Copyright (c) 2014 by Lourival Vieira Neto <lneto@NetBSD.org>.
@@ -653,8 +653,10 @@ klua_newstate(lua_Alloc f, void *ud, const char *name, const char *desc,
sc->sc_state = true;
mutex_exit(&sc->sc_state_lock);
- if (error)
+ if (error) {
+ kmem_free(s, sizeof(struct lua_state));
return NULL;
+ }
K = kmem_zalloc(sizeof(klua_State), KM_SLEEP);
K->L = lua_newstate(f, ud);