diff options
author | Reuben Thomas <rrt@sc3d.org> | 2012-10-04 18:59:27 +0100 |
---|---|---|
committer | Reuben Thomas <rrt@sc3d.org> | 2012-10-04 18:59:27 +0100 |
commit | ba7c99ebf3758e8c9fba10f946a6b35e8d7b4fbf (patch) | |
tree | 964e03abc36967860834b6915cfc44c1baafd9f7 | |
parent | bb7fefc410b84fcfea40b0abc84383fd9d081f88 (diff) | |
download | lrexlib-ba7c99ebf3758e8c9fba10f946a6b35e8d7b4fbf.tar.gz |
common.c: remove last use of non-Lua state malloc
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/common.c | 4 |
2 files changed, 4 insertions, 1 deletions
@@ -9,6 +9,7 @@ * Allow POSIX REG_STARTEND to be used on any system supporting it. * Add a test set for POSIX regex engine (thanks, Enrico Tassi). * Simplify some code. + * Always use Lua state memory allocator. 2012-04-13 Release 2.6.0 diff --git a/src/common.c b/src/common.c index 3ae87f0..fabbd80 100644 --- a/src/common.c +++ b/src/common.c @@ -28,7 +28,9 @@ void set_int_field (lua_State *L, const char* field, int val) } void *Lmalloc(lua_State *L, size_t size) { - void *p = malloc(size); + void *ud; + lua_Alloc lalloc = lua_getallocf(L, &ud); + void *p = lalloc(L, NULL, 0, size); if(p == NULL) luaL_error(L, "malloc failed"); return p; |