From 3ab86cd12adaa0ba9d0e59d5032a9547782bae83 Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 7 Feb 2015 04:09:13 +0000 Subject: plug leak on error. Reported by: http://www.m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-4 --- 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 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 . @@ -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); -- cgit