From 1fe028d387704d46ef777a3f47168baa2262ef78 Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Wed, 1 May 2019 19:50:21 +0700 Subject: [PATCH] lua plugin: Don't destroy interpreter early If script successfully registered at least one callback, destroying interpreter will cause Collectd crash when that callback will be called. Unfortunately, there is no way to unregister these callbacks --- src/lua.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lua.c b/src/lua.c index d1c00850..b5d3ce54 100644 --- a/src/lua.c +++ b/src/lua.c @@ -471,9 +471,6 @@ static int lua_script_load(const char *script_path) /* {{{ */ else ERROR("Lua plugin: Executing script \"%s\" failed:\n%s", script_path, errmsg); - - lua_script_free(script); - return -1; } /* Append this script to the global list of scripts. */ @@ -487,6 +484,9 @@ static int lua_script_load(const char *script_path) /* {{{ */ scripts = script; } + if (status != 0) + return -1; + return 0; } /* }}} int lua_script_load */ -- 2.11.0