]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Re-add dlclose(handle) when module initialization failed
authorVolker Lendecke <vl@samba.org>
Tue, 26 Aug 2025 07:50:04 +0000 (09:50 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 1 Sep 2025 17:04:27 +0000 (17:04 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Sep  1 17:04:27 UTC 2025 on atb-devel-224

lib/util/modules.c

index cafc73d62597074283131290e61877ad1a04fedc..b8d6e4cfcd14bad28d601d7320d2022868d33ccb 100644 (file)
@@ -151,6 +151,7 @@ init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, const char *subsystem)
 static NTSTATUS load_module_absolute_path(const char *module_path,
                                          bool is_probe)
 {
+       void *handle = NULL;
        init_module_fn init;
        NTSTATUS status;
 
@@ -158,7 +159,7 @@ static NTSTATUS load_module_absolute_path(const char *module_path,
                 is_probe ? "Probing" : "Loading",
                 module_path);
 
-       init = load_module(module_path, is_probe, NULL);
+       init = load_module(module_path, is_probe, &handle);
        if (init == NULL) {
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -170,6 +171,7 @@ static NTSTATUS load_module_absolute_path(const char *module_path,
                DBG_ERR("Module '%s' initialization failed: %s\n",
                        module_path,
                        get_friendly_nt_error_msg(status));
+               dlclose(handle);
                return status;
        }