if (de_ctx->keyword_id > 0) {
DetectEngineThreadKeywordCtxItem *item = de_ctx->keyword_list;
while (item) {
- item->FreeFunc(det_ctx->keyword_ctxs_array[item->id]);
+ if (det_ctx->keyword_ctxs_array[item->id] != NULL)
+ item->FreeFunc(det_ctx->keyword_ctxs_array[item->id]);
+
item = item->next;
}
det_ctx->keyword_ctxs_size = 0;
t->flags = luajit->flags;
t->luastate = luaL_newstate();
+
if (t->luastate == NULL) {
SCLogError(SC_ERR_LUAJIT_ERROR, "couldn't set up luastate");
goto error;
}
static void DetectLuajitThreadFree(void *ctx) {
- DetectLuajitThreadData *t = (DetectLuajitThreadData *)ctx;
-
- lua_close(t->luastate);
-
- SCFree(t);
+ if (ctx != NULL) {
+ DetectLuajitThreadData *t = (DetectLuajitThreadData *)ctx;
+ lua_close(t->luastate);
+ SCFree(t);
+ }
}
/**