The branch, v3-2-test has been updated
       via  496d44d2f21661c85bf07e8eb7cae6298fefd900 (commit)
      from  999533c0ccced59141d8baff5bc248d63e2a966f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 496d44d2f21661c85bf07e8eb7cae6298fefd900
Author: Volker Lendecke <[EMAIL PROTECTED]>
Date:   Fri Jun 13 16:05:31 2008 +0200

    Fix a handle leak for error returns in ldb_try_load_dso
    
    Coverity ID 464

-----------------------------------------------------------------------

Summary of changes:
 source/lib/ldb/common/ldb_modules.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/ldb/common/ldb_modules.c 
b/source/lib/ldb/common/ldb_modules.c
index 68c4535..d898f3d 100644
--- a/source/lib/ldb/common/ldb_modules.c
+++ b/source/lib/ldb/common/ldb_modules.c
@@ -206,6 +206,7 @@ int ldb_try_load_dso(struct ldb_context *ldb, const char 
*name)
        void *handle;
        int (*init_fn) (void);
        char *modulesdir;
+       int ret;
 
 #ifdef HAVE_DLOPEN
        if (getenv("LD_LDB_MODULE_PATH") != NULL) {
@@ -234,12 +235,17 @@ int ldb_try_load_dso(struct ldb_context *ldb, const char 
*name)
 
        if (init_fn == NULL) {
                ldb_debug(ldb, LDB_DEBUG_ERROR, "no symbol `init_module' found 
in %s: %s\n", path, dlerror());
+               dlclose(handle);
                return -1;
        }
 
        talloc_free(path);
 
-       return init_fn();
+       ret = init_fn();
+       if (ret == -1) {
+               dlclose(handle);
+       }
+       return ret;
 #else
        ldb_debug(ldb, LDB_DEBUG_TRACE, "no dlopen() - not trying to load %s 
module\n", name);
        return -1;


-- 
Samba Shared Repository

Reply via email to