[PATCH v2 2/6] Add functions to ease using Lua iterators from C
Alexander Turenko
alexander.turenko at tarantool.org
Mon Jan 28 21:17:16 MSK 2019
Updated a bit:
diff --git a/src/lua/utils.c b/src/lua/utils.c
index 173d59a59..c8cfa70b3 100644
--- a/src/lua/utils.c
+++ b/src/lua/utils.c
@@ -981,6 +981,11 @@ struct luaL_iterator *
luaL_iterator_new(lua_State *L, int idx)
{
struct luaL_iterator *it = malloc(sizeof(struct luaL_iterator));
+ if (it == NULL) {
+ diag_set(OutOfMemory, sizeof(struct luaL_iterator),
+ "malloc", "luaL_iterator");
+ return NULL;
+ }
if (idx == 0) {
/* gen, param, state are on top of a Lua stack. */
More information about the Tarantool-patches
mailing list