From 896f88361ec8a15a20688eb533a65977ee698974 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Sun, 14 Sep 2008 04:54:49 +0000 Subject: [PATCH] 2442. [bug] A lock could be destroyed twice. [RT# 18626] --- CHANGES | 2 ++ lib/isc/radix.c | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 03799b2686..cb393de872 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +2442. [bug] A lock could be destroyed twice. [RT# 18626] + 2441. [bug] isc_radix_insert() could copy radix tree nodes incompletely. [RT #18573] diff --git a/lib/isc/radix.c b/lib/isc/radix.c index 19c0e8c5f3..3671386398 100644 --- a/lib/isc/radix.c +++ b/lib/isc/radix.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: radix.c,v 1.17 2008/09/12 23:47:25 tbox Exp $ */ +/* $Id: radix.c,v 1.18 2008/09/14 04:54:49 marka Exp $ */ /* * This source was adapted from MRT's RCS Ids: @@ -98,13 +98,15 @@ _ref_prefix(isc_mem_t *mctx, isc_prefix_t **target, isc_prefix_t *prefix) { (prefix->family == AF_INET6 && prefix->bitlen <= 128)); REQUIRE(target != NULL); - /* If this prefix is a static allocation, copy it into new memory */ + /* + * If this prefix is a static allocation, copy it into new memory. + * (Note, the refcount still has to be destroyed by the calling + * routine.) + */ if (isc_refcount_current(&prefix->refcount) == 0) { isc_result_t ret; ret = _new_prefix(mctx, target, prefix->family, &prefix->add, prefix->bitlen); - if (ret == ISC_R_SUCCESS) - isc_refcount_destroy(&prefix->refcount); return ret; }