CID 458. Don't leak dlopen handles on failing to load
authorJeremy Allison <jra@samba.org>
Sat, 12 Jan 2008 08:15:46 +0000 (00:15 -0800)
committerJeremy Allison <jra@samba.org>
Sat, 12 Jan 2008 08:15:46 +0000 (00:15 -0800)
module.
Jeremy.
(This used to be commit 8809eaeb154ea12543455f589e31172dc905d83a)

source3/lib/module.c

index fa06d14b49d20abb9e0523ae3e25ad361af8bb29..285bd9c4c07e32dc2963cb47556397d82926b767 100644 (file)
@@ -57,6 +57,7 @@ static NTSTATUS do_smb_load_module(const char *module_name, bool is_probe)
        if (error) {
                DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", 
                          module_name, error));
+               sys_dlclose(handle);
                return NT_STATUS_UNSUCCESSFUL;
        }
 
@@ -66,6 +67,7 @@ static NTSTATUS do_smb_load_module(const char *module_name, bool is_probe)
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("Module '%s' initialization failed: %s\n",
                            module_name, get_friendly_nt_error_msg(status)));
+               sys_dlclose(handle);
        }
 
        return status;