From: Pavel Rochnyack Date: Wed, 1 May 2019 12:50:21 +0000 (+0700) Subject: lua plugin: Don't destroy interpreter early X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=1fe028d387704d46ef777a3f47168baa2262ef78;p=collectd.git 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 --- 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 */