Module Name: src Committed By: christos Date: Sat Feb 7 04:09:13 UTC 2015
Modified Files: src/sys/modules/lua: lua.c Log Message: plug leak on error. Reported by: http://www.m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-4 To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/modules/lua/lua.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/modules/lua/lua.c diff -u src/sys/modules/lua/lua.c:1.15 src/sys/modules/lua/lua.c:1.16 --- src/sys/modules/lua/lua.c:1.15 Sun Nov 30 14:15:03 2014 +++ src/sys/modules/lua/lua.c Fri Feb 6 23:09:13 2015 @@ -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 <ln...@netbsd.org>. @@ -653,8 +653,10 @@ klua_newstate(lua_Alloc f, void *ud, con 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);