luajit: fix crash at shutdown / rule reload if lua script didn't properly init.

pull/81/head
Victor Julien 13 years ago
parent 8192f6ce8c
commit 6f7e527e92

@ -724,7 +724,9 @@ static void DetectEngineThreadCtxDeinitKeywords(DetectEngineCtx *de_ctx, DetectE
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;

@ -383,6 +383,7 @@ static void *DetectLuajitThreadInit(void *data) {
t->flags = luajit->flags;
t->luastate = luaL_newstate();
if (t->luastate == NULL) {
SCLogError(SC_ERR_LUAJIT_ERROR, "couldn't set up luastate");
goto error;
@ -412,11 +413,11 @@ 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);
}
}
/**

Loading…
Cancel
Save