fix(lua/name): fix memory leak

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-11-02 20:57:41 -07:00
parent dbf2d56c77
commit ccd95a9b66

View file

@ -29,10 +29,12 @@ static int mk_name(lua_State * L) {
new (mem) name(str);
} else {
lean_assert(nargs == 2);
name tmp;
name * prefix;
if (lua_isstring(L, 1)) {
char const * str = luaL_checkstring(L, 1);
prefix = new name(str);
tmp = name(str);
prefix = &tmp;
} else {
prefix = static_cast<name*>(luaL_checkudata(L, 1, "name.mt"));
}