lua-users home
lua-l archive

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


   lua_Alloc f = lua_getallocf(L, &ud);
   slen = luaL_optlong(L, 2, slen);
   buf = (*f)(ud, NULL, 0, (2 * slen));
   dlen = apreq_quote(buf, src, slen);
   lua_pushlstring(L, buf, dlen);
   (*f)(ud, buf, (2 * slen), 0);
   return 1;

Is there something wrong with this code ?

Just because you asked, there's a very minor problem which is common in a lot of code - a memerr on the pushlstring will result in a memory leak. No neat fix though.

- Alex