mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 17:31:20 +02:00
lua: fix memleak
This commit is contained in:
@@ -176,12 +176,12 @@ void *CLuaServer::luaserver_thread(void *arg) {
|
|||||||
pthread_t wdthr;
|
pthread_t wdthr;
|
||||||
pthread_create (&wdthr, NULL, luaclient_watchdog, (void *) lsd);
|
pthread_create (&wdthr, NULL, luaclient_watchdog, (void *) lsd);
|
||||||
|
|
||||||
CLuaInstance lua;
|
CLuaInstance *lua = new CLuaInstance();
|
||||||
lsd->lua = &lua;
|
lsd->lua = *&lua;
|
||||||
std::string result_code;
|
std::string result_code;
|
||||||
std::string result_string;
|
std::string result_string;
|
||||||
std::string error_string;
|
std::string error_string;
|
||||||
lua.runScript(lsd->script.c_str(), &lsd->argv, &result_code, &result_string, &error_string);
|
lua->runScript(lsd->script.c_str(), &lsd->argv, &result_code, &result_string, &error_string);
|
||||||
pthread_cancel(wdthr);
|
pthread_cancel(wdthr);
|
||||||
pthread_join(wdthr, NULL);
|
pthread_join(wdthr, NULL);
|
||||||
if (!lsd->died) {
|
if (!lsd->died) {
|
||||||
@@ -202,7 +202,9 @@ void *CLuaServer::luaserver_thread(void *arg) {
|
|||||||
rp += error_string_len;
|
rp += error_string_len;
|
||||||
CBasicServer::send_data(lsd->fd, result, size);
|
CBasicServer::send_data(lsd->fd, result, size);
|
||||||
}
|
}
|
||||||
|
delete lua;
|
||||||
delete lsd;
|
delete lsd;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
if (instance) {
|
if (instance) {
|
||||||
instance->count--;
|
instance->count--;
|
||||||
|
Reference in New Issue
Block a user