diff --git a/src/detect-luajit.c b/src/detect-luajit.c index a88c550bc6..569980dc58 100644 --- a/src/detect-luajit.c +++ b/src/detect-luajit.c @@ -321,6 +321,11 @@ int DetectLuajitMatchBuffer(DetectEngineThreadCtx *det_ctx, Signature *s, SigMat SCLogDebug("no stack"); } + /* clear the stack */ + while (lua_gettop(tluajit->luastate) > 0) { + lua_pop(tluajit->luastate, 1); + } + if (luajit->negated) { if (ret == 1) ret = 0; @@ -457,6 +462,9 @@ static int DetectLuajitMatch (ThreadVars *tv, DetectEngineThreadCtx *det_ctx, lua_pop(tluajit->luastate, 1); } } + while (lua_gettop(tluajit->luastate) > 0) { + lua_pop(tluajit->luastate, 1); + } if (luajit->negated) { if (ret == 1)