From: Arran Cudbard-Bell Date: Wed, 21 Jun 2017 22:24:52 +0000 (-0400) Subject: Set the dl pointer to NULL, so the tree is recreated if more modules are loaded after... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77cfb11632ff9dbdbcee4cfdd64353d4df53a954;p=thirdparty%2Ffreeradius-server.git Set the dl pointer to NULL, so the tree is recreated if more modules are loaded after they've all been freed --- diff --git a/src/main/dl.c b/src/main/dl.c index 763078220df..caa3dca32c1 100644 --- a/src/main/dl.c +++ b/src/main/dl.c @@ -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; }