Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/modules/lua plug leak on error. Reported by:



details:   https://anonhg.NetBSD.org/src/rev/9589397defb5
branches:  trunk
changeset: 336017:9589397defb5
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Feb 07 04:09:13 2015 +0000

description:
plug leak on error. Reported by:
http://www.m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-4

diffstat:

 sys/modules/lua/lua.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 434cd38c438a -r 9589397defb5 sys/modules/lua/lua.c
--- a/sys/modules/lua/lua.c     Sat Feb 07 04:06:52 2015 +0000
+++ b/sys/modules/lua/lua.c     Sat Feb 07 04:09:13 2015 +0000
@@ -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@localhost>.
@@ -653,8 +653,10 @@
                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);



Home | Main Index | Thread Index | Old Index