Skip to content

Commit

Permalink
Set the dl pointer to NULL, so the tree is recreated if more modules …
Browse files Browse the repository at this point in the history
…are loaded after they've all been freed
  • Loading branch information
arr2036 committed Jun 21, 2017
1 parent 380e764 commit 77cfb11
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/dl.c
Expand Up @@ -484,7 +484,13 @@ static int _dl_free(dl_t *module)
module->handle = NULL;

rbtree_deletebydata(dl->tree, module);
if (rbtree_num_elements(dl->tree) == 0) talloc_free(dl);

/*
* If everything has been freed, autofree the tree.
* dl *MUST* be set to NULL, so that if the server decides to
* load more modules, the tree is recreated.
*/
if (rbtree_num_elements(dl->tree) == 0) TALLOC_FREE(dl);

return 0;
}
Expand Down

0 comments on commit 77cfb11

Please sign in to comment.