]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
attempt to silence leaked lock false positive
authorMark Andrews <marka@isc.org>
Wed, 4 Jun 2014 04:07:16 +0000 (14:07 +1000)
committerMark Andrews <marka@isc.org>
Wed, 4 Jun 2014 05:23:07 +0000 (15:23 +1000)
lib/dns/resolver.c

index 3a86ec7fa1c956499fb32fe8923809231a21c0c0..4a571c5ae0dc31912ace7ddef1ec58761e6f189a 100644 (file)
@@ -4267,6 +4267,7 @@ validated(isc_task_t *task, isc_event_t *event) {
        isc_stdtime_t now;
        isc_uint32_t ttl;
        unsigned options;
+       isc_uint32_t bucketnum;
 
        UNUSED(task); /* for now */
 
@@ -4283,7 +4284,8 @@ validated(isc_task_t *task, isc_event_t *event) {
 
        FCTXTRACE("received validation completion event");
 
-       LOCK(&res->buckets[fctx->bucketnum].lock);
+       bucketnum = fctx->bucketnum;
+       LOCK(&res->buckets[bucketnum].lock);
 
        ISC_LIST_UNLINK(fctx->validators, vevent->validator, link);
        fctx->validator = NULL;
@@ -4305,7 +4307,6 @@ validated(isc_task_t *task, isc_event_t *event) {
         * so, destroy the fctx.
         */
        if (SHUTTINGDOWN(fctx) && !sentresponse) {
-               isc_uint32_t bucketnum = fctx->bucketnum;
                isc_boolean_t bucket_empty;
                bucket_empty = maybe_destroy(fctx, ISC_TRUE);
                UNLOCK(&res->buckets[bucketnum].lock);
@@ -4408,7 +4409,7 @@ validated(isc_task_t *task, isc_event_t *event) {
                result = fctx->vresult;
                add_bad(fctx, addrinfo, result, badns_validation);
                isc_event_free(&event);
-               UNLOCK(&res->buckets[fctx->bucketnum].lock);
+               UNLOCK(&res->buckets[bucketnum].lock);
                INSIST(fctx->validator == NULL);
                fctx->validator = ISC_LIST_HEAD(fctx->validators);
                if (fctx->validator != NULL)
@@ -4539,7 +4540,7 @@ validated(isc_task_t *task, isc_event_t *event) {
                dns_db_detachnode(fctx->cache, &node);
                if (SHUTTINGDOWN(fctx))
                        bucket_empty = maybe_destroy(fctx, ISC_TRUE);
-               UNLOCK(&res->buckets[fctx->bucketnum].lock);
+               UNLOCK(&res->buckets[bucketnum].lock);
                if (bucket_empty)
                        empty_bucket(res);
                goto cleanup_event;
@@ -4556,7 +4557,7 @@ validated(isc_task_t *task, isc_event_t *event) {
                 * be validated.
                 */
                dns_db_detachnode(fctx->cache, &node);
-               UNLOCK(&res->buckets[fctx->bucketnum].lock);
+               UNLOCK(&res->buckets[bucketnum].lock);
                dns_validator_send(ISC_LIST_HEAD(fctx->validators));
                goto cleanup_event;
        }
@@ -4639,7 +4640,7 @@ validated(isc_task_t *task, isc_event_t *event) {
        if (node != NULL)
                dns_db_detachnode(fctx->cache, &node);
 
-       UNLOCK(&res->buckets[fctx->bucketnum].lock);
+       UNLOCK(&res->buckets[bucketnum].lock);
        fctx_done(fctx, result, __LINE__); /* Locks bucket. */
 
  cleanup_event: