]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib:util: Fix resourse leak CID#1412633
authorVinit Agnihotri <vagnihot@redhat.com>
Thu, 14 Aug 2025 10:34:17 +0000 (16:04 +0530)
committerAnoop C S <anoopcs@samba.org>
Fri, 15 Aug 2025 06:19:51 +0000 (06:19 +0000)
Stop using un-needed variable 'handle', this variable is not used
anywhere later.
Also load_module() internally allocates and uses handle, which suffice
for its operation.

This fixes resource leak issue reported by coverity #1412633

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Aug 15 06:19:51 UTC 2025 on atb-devel-224

lib/util/modules.c

index 4260234b00708158dfba9baed1039416c55fc5bb..cafc73d62597074283131290e61877ad1a04fedc 100644 (file)
@@ -151,7 +151,6 @@ 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;
        init_module_fn init;
        NTSTATUS status;
 
@@ -159,7 +158,7 @@ static NTSTATUS load_module_absolute_path(const char *module_path,
                 is_probe ? "Probing" : "Loading",
                 module_path);
 
-       init = load_module(module_path, is_probe, &handle);
+       init = load_module(module_path, is_probe, NULL);
        if (init == NULL) {
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -171,7 +170,6 @@ 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;
        }