lua-users home
lua-l archive

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


Hi Reuben,

I've just incorporated your rex and bit libraries into luacheia.  Nice
work, I appreciate you releasing these!

Anyway, I came across what I think is a bug in lrexlib.c.  It appears
that the regex_t userdata is being freed twice; once by rex_gc(), and
then again by Lua.  Here's the change I have made in the luacheia
version:

----
static int rex_gc (lua_State *L) {
  regex_t *r = (regex_t *)luaL_checkudata(L, 1, "regex_t");
  if (r) {
    regfree(r);
    /* free(r); */	/* luacheia: don't double-free! */
  }
  return 0;
}
----

-- 
Thatcher Ulrich
http://tulrich.com