mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 18:48:14 +00:00
Merge pull request #13445 from donaldsharp/lua_scripting_mem_leak
zebra: Reduce creation and fix memory leak of frrscripting pointers
This commit is contained in:
commit
bae305fc9b
@ -4704,6 +4704,21 @@ static void rib_process_dplane_results(struct event *thread)
|
||||
struct dplane_ctx_list_head ctxlist;
|
||||
bool shut_p = false;
|
||||
|
||||
#ifdef HAVE_SCRIPTING
|
||||
char *script_name =
|
||||
frrscript_names_get_script_name(ZEBRA_ON_RIB_PROCESS_HOOK_CALL);
|
||||
|
||||
int ret = 1;
|
||||
struct frrscript *fs = NULL;
|
||||
|
||||
if (script_name) {
|
||||
fs = frrscript_new(script_name);
|
||||
if (fs)
|
||||
ret = frrscript_load(fs, ZEBRA_ON_RIB_PROCESS_HOOK_CALL,
|
||||
NULL);
|
||||
}
|
||||
#endif /* HAVE_SCRIPTING */
|
||||
|
||||
/* Dequeue a list of completed updates with one lock/unlock cycle */
|
||||
|
||||
do {
|
||||
@ -4737,24 +4752,7 @@ static void rib_process_dplane_results(struct event *thread)
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SCRIPTING
|
||||
char *script_name = frrscript_names_get_script_name(
|
||||
ZEBRA_ON_RIB_PROCESS_HOOK_CALL);
|
||||
|
||||
int ret = 1;
|
||||
struct frrscript *fs;
|
||||
|
||||
if (script_name) {
|
||||
fs = frrscript_new(script_name);
|
||||
if (fs)
|
||||
ret = frrscript_load(
|
||||
fs, ZEBRA_ON_RIB_PROCESS_HOOK_CALL,
|
||||
NULL);
|
||||
}
|
||||
#endif /* HAVE_SCRIPTING */
|
||||
|
||||
while (ctx) {
|
||||
|
||||
#ifdef HAVE_SCRIPTING
|
||||
if (ret == 0)
|
||||
frrscript_call(fs,
|
||||
@ -4869,6 +4867,11 @@ static void rib_process_dplane_results(struct event *thread)
|
||||
}
|
||||
|
||||
} while (1);
|
||||
|
||||
#ifdef HAVE_SCRIPTING
|
||||
if (fs)
|
||||
frrscript_delete(fs);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user