]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Set the dl pointer to NULL, so the tree is recreated if more modules are loaded after...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 21 Jun 2017 22:24:52 +0000 (18:24 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 21 Jun 2017 22:24:52 +0000 (18:24 -0400)
src/main/dl.c

index 763078220dfdf00b5838ef89e756b4bdf365dd16..caa3dca32c1950faa3d5834b0c136fd75a898398 100644 (file)
@@ -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;
 }