]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3954. [bug] Unchecked mutex init in dlz_dlopen_driver.c [RT #37112]
authorMark Andrews <marka@isc.org>
Sat, 27 Sep 2014 02:30:00 +0000 (12:30 +1000)
committerMark Andrews <marka@isc.org>
Sat, 27 Sep 2014 02:30:43 +0000 (12:30 +1000)
(cherry picked from commit 6b6d6509f6d80afae74eeb9f2e5baba696e29f32)

CHANGES
bin/named/win32/dlz_dlopen_driver.c

diff --git a/CHANGES b/CHANGES
index 8731ba8f1da0c43cb011605540d01d7030527c8f..58d9a553909f28d0364cd1cda93c34e91abd2d03 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+3954.  [bug]           Unchecked mutex init in dlz_dlopen_driver.c [RT #37112]
+
 3953.  [bug]           Don't escape semi-colon in TXT fields. [RT #37159]
 
 3952.  [bug]           dns_name_fullcompare failed to set *nlabelsp when the
index 550769dc196ee6512dc82cd0bf860308c6348189..5ba6c9a9eb65add26e25fa2ce81b0dc9780dad6c 100644 (file)
@@ -252,7 +252,9 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
        triedload = ISC_TRUE;
 
        /* Initialize the lock */
-       isc_mutex_init(&cd->lock);
+       result = isc_mutex_init(&cd->lock);
+       if (result != ISC_R_SUCCESS)
+               goto failed;
 
        /* Open the library */
        cd->dl_handle = LoadLibraryA(cd->dl_path);
@@ -263,7 +265,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
                           "dlz_dlopen failed to open library '%s' - %u",
                           cd->dl_path, error);
                result = ISC_R_FAILURE;
-               goto failed;
+               goto cleanup_lock;
        }
 
        /* Find the symbols */
@@ -282,7 +284,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
        {
                /* We're missing a required symbol */
                result = ISC_R_FAILURE;
-               goto failed;
+               goto cleanup_lock;
        }
 
        cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *)
@@ -316,7 +318,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
                           "should be %d in '%s'",
                           cd->version, DLZ_DLOPEN_VERSION, cd->dl_path);
                result = ISC_R_FAILURE;
-               goto failed;
+               goto cleanup_lock;
        }
 
        /*
@@ -336,12 +338,14 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
                                NULL);
        MAYBE_UNLOCK(cd);
        if (result != ISC_R_SUCCESS)
-               goto failed;
+               goto cleanup_lock;
 
        *dbdata = cd;
 
        return (ISC_R_SUCCESS);
 
+cleanup_lock:
+       DESTROYLOCK(&cd->lock);
 failed:
        dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname);
        if (cd->dl_path)
@@ -382,7 +386,7 @@ dlopen_dlz_destroy(void *driverarg, void *dbdata) {
        if (cd->dl_handle)
                FreeLibrary(cd->dl_handle);
 
-       (void) isc_mutex_destroy(&cd->lock);
+       DESTROYLOCK(&cd->lock);
 
        mctx = cd->mctx;
        isc_mem_put(mctx, cd, sizeof(*cd));