]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pass rng to destroy
authorMark Andrews <marka@isc.org>
Wed, 11 Jun 2014 12:57:46 +0000 (22:57 +1000)
committerMark Andrews <marka@isc.org>
Wed, 11 Jun 2014 12:57:46 +0000 (22:57 +1000)
lib/dns/rdata/generic/hip_55.c
lib/isc/random.c

index 5198497dcb07824fab5629b554942c2af4675090..e69c2685a01e976d6fb59f9d5c34e82322188486 100644 (file)
@@ -318,6 +318,8 @@ tostruct_hip(ARGS_TOSTRUCT) {
                goto cleanup;
        isc_region_consume(&region, hip->hit_len);
 
+       INSIST(hip->key_len <= region.length);
+
        hip->key = mem_maybedup(mctx, region.base, hip->key_len);
        if (hip->key == NULL)
                goto cleanup;
index 0979f3e68db80dc05f03111ce161c5e68dc2ff1e..424e65b04a5f2c3552b192fac4e742c04ff38d40 100644 (file)
@@ -243,15 +243,13 @@ isc_rng_attach(isc_rng_t *source, isc_rng_t **targetp) {
 }
 
 static void
-destroy(isc_rng_t **rngp) {
-       isc_rng_t *rng = *rngp;
+destroy(isc_rng_t *rng) {
 
        REQUIRE(VALID_RNG(rng));
 
-       isc_mutex_destroy(&rng->lock);
        rng->magic = 0;
+       isc_mutex_destroy(&rng->lock);
        isc_mem_putanddetach(&rng->mctx, rng, sizeof(isc_rng_t));
-       *rngp = NULL;
 }
 
 void
@@ -273,7 +271,7 @@ isc_rng_detach(isc_rng_t **rngp) {
        UNLOCK(&rng->lock);
 
        if (dest)
-               destroy(rngp);
+               destroy(rng);
 }
 
 static void