return NULL;
}
+static void LogLuaSubFree(OutputCtx *oc) {
+ if (oc->data)
+ SCFree(oc->data);
+ SCFree(oc);
+}
+
/** \brief initialize output for a script instance
*
* Runs script 'setup' function.
SCLogDebug("lua_ctx %p", lua_ctx);
output_ctx->data = lua_ctx;
- output_ctx->DeInit = NULL;
+ output_ctx->DeInit = LogLuaSubFree;
return output_ctx;
error:
return NULL;
}
-static void LogLuaMasterFree(OutputCtx *oc) {
- BUG_ON(oc == NULL);
+static void LogLuaMasterFree(OutputCtx *oc)
+{
if (oc->data)
SCFree(oc->data);
+
+ OutputModule *om, *tom;
+ TAILQ_FOREACH_SAFE(om, &oc->submodules, entries, tom) {
+ SCFree(om);
+ }
+ SCFree(oc);
}
/** \internal
SCLogError(SC_ERR_LUA_ERROR, "couldn't run script 'deinit' function: %s", lua_tostring(luastate, -1));
return;
}
+ lua_close(luastate);
}
/** \internal
} else if (strcmp(output->val, "lua") == 0) {
SCLogDebug("handle lua");
+ OutputModule *lua_module = OutputGetModuleByConfName(output->val);
+ BUG_ON(lua_module == NULL);
+ AddOutputToFreeList(lua_module, output_ctx);
+
ConfNode *scripts = ConfNodeLookupChild(output_config, "scripts");
BUG_ON(scripts == NULL); //TODO
continue;
}
+ AddOutputToFreeList(m, sub_output_ctx);
SetupOutput(m->name, m, sub_output_ctx);
}