Skip to content

Commit

Permalink
Fix memory leak in lua watch tree code
Browse files Browse the repository at this point in the history
  • Loading branch information
blairsteven authored and carlgsmith committed Sep 20, 2024
1 parent 5d26b38 commit 1d9cde4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ lua_do_watch_tree (GNode *tree, lua_callback_info *cb_info)
if (!callback_valid (cb_info))
{
ERROR ("Watch: cb_info released already\n");
apteryx_free_tree(tree);
return false;
}

Expand All @@ -702,6 +703,7 @@ lua_do_watch_tree (GNode *tree, lua_callback_info *cb_info)
{
printf("%s: unable to push callback", __FUNCTION__);
lua_apteryx_instance_unlock (L);
apteryx_free_tree(tree);
return false;
}

Expand All @@ -720,6 +722,8 @@ lua_do_watch_tree (GNode *tree, lua_callback_info *cb_info)
lua_apteryx_instance_unlock (L);
}

apteryx_free_tree(tree);

return true;
}

Expand Down

0 comments on commit 1d9cde4

Please sign in to comment.