Skip to content

Commit

Permalink
github-ci: Fix misplaced alloc fail check
Browse files Browse the repository at this point in the history
  • Loading branch information
J0eJ0h committed Jan 29, 2024
1 parent 95a6a01 commit f543ca9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/util-lua-sandbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,17 @@ LUALIB_API void sb_loadrestricted(lua_State *L)
lua_State *sb_newstate(uint64_t alloclimit, uint64_t instructionlimit)
{
sb_lua_state *sb = SCMalloc(sizeof(sb_lua_state));
if (sb == NULL) {
// Out of memory. Error code?
return NULL;
}

sb->alloc_limit = alloclimit;
sb->alloc_bytes = 0;
sb->hook_instruction_count = 100;
sb->instruction_limit = instructionlimit;

sb->L = lua_newstate(sb_alloc, sb); /* create state */
if (sb == NULL) {
// Out of memory. Error code?
return NULL;
}
sb->L = lua_newstate(sb_alloc, sb); /* create state */
if (sb->L == NULL) {
// TODO: log or error code?
SCFree(sb);
Expand Down

0 comments on commit f543ca9

Please sign in to comment.