diff options
| author | Donald Lee <dlqs@gmx.com> | 2021-07-08 01:31:43 +0800 |
|---|---|---|
| committer | Donald Lee <dlqs@gmx.com> | 2021-07-18 06:32:03 +0800 |
| commit | fae19fa56d110b27bc4f507221573b432cdfc9a8 (patch) | |
| tree | bc027191d627b6e957bff676cdfe958f8413bd51 /lib/frrscript.c | |
| parent | 8a79921ca350faea6576c49ed1e41f8a3cf4ee0f (diff) | |
lib: frrscript unload deallocates Lua function
Signed-off-by: Donald Lee <dlqs@gmx.com>
Diffstat (limited to 'lib/frrscript.c')
| -rw-r--r-- | lib/frrscript.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/frrscript.c b/lib/frrscript.c index 5352c6470d..9b497a431d 100644 --- a/lib/frrscript.c +++ b/lib/frrscript.c @@ -102,6 +102,7 @@ static void codec_free(struct codec *c) } #endif +/* Lua function hash utils */ unsigned int lua_function_hash_key(const void *data) { @@ -129,11 +130,11 @@ void *lua_function_alloc(void *arg) return lfs; } -static void lua_function_free(struct lua_function_state *lfs) +static void lua_function_free(struct hash_bucket *b, void *data) { - XFREE(MTYPE_TMP, lfs->name); + struct lua_function_state *lfs = (struct lua_function_state *)b->data; lua_close(lfs->L); - XFREE(MTYPE_TMP, lfs); + XFREE(MTYPE_SCRIPT, lfs); } /* Generic script APIs */ @@ -313,6 +314,7 @@ fail: void frrscript_unload(struct frrscript *fs) { + hash_iterate(fs->lua_function_hash, lua_function_free, NULL); XFREE(MTYPE_SCRIPT, fs->name); XFREE(MTYPE_SCRIPT, fs); } |
