Skip to content

Commit

Permalink
Fix: memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed May 14, 2024
1 parent 201dff1 commit d9a947e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/web_server/scripts.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ static void send_script_raw_error(unsigned long conn_id, const char *partition,
* @param script_thread_arg pointer to t_script_thread_arg struct
*/
static void *script_execute_async_http(void *script_thread_arg) {

thread_logname = sds_replace(thread_logname, "http_script");
set_threadname(thread_logname);
struct t_script_thread_arg *script_arg = (struct t_script_thread_arg *) script_thread_arg;
Expand All @@ -157,13 +156,15 @@ static void *script_execute_async_http(void *script_thread_arg) {
send_script_raw_error(script_arg->conn_id, script_arg->partition, "Error executing script: Memory allocation error");
free_t_script_thread_arg(script_arg);
http_script_threads--;
FREE_SDS(thread_logname);
return NULL;
}
if (rc != 0) {
lua_close(lua_vm);
send_script_raw_error(script_arg->conn_id, script_arg->partition, "Error loading script");
free_t_script_thread_arg(script_arg);
http_script_threads--;
FREE_SDS(thread_logname);
return NULL;
}

Expand All @@ -190,6 +191,7 @@ static void *script_execute_async_http(void *script_thread_arg) {
lua_close(lua_vm);
free_t_script_thread_arg(script_arg);
http_script_threads--;
FREE_SDS(thread_logname);
return NULL;
}
//error
Expand Down

0 comments on commit d9a947e

Please sign in to comment.