From c6ee5082db1e40ab64e08a540620da79996efa9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatuya=20JINMEI=20=E7=A5=9E=E6=98=8E=E9=81=94=E5=93=89?= Date: Thu, 6 Jul 2006 06:36:51 +0000 Subject: [PATCH] 2046. [bug] rbtdb.c:rdataset_setadditional() could cause duplicate cleanup. --- CHANGES | 3 +++ lib/dns/rbtdb.c | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index d4215627a0..b689247dca 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2046. [bug] rbtdb.c:rdataset_setadditional() could cause duplicate + cleanup. + 2045. [func] use lock buckets for acache entries to limit memory consumption. [RT #16183] diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index c6aa830349..5093d5d734 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbtdb.c,v 1.235 2006/06/13 04:49:18 marka Exp $ */ +/* $Id: rbtdb.c,v 1.236 2006/07/06 06:36:51 jinmei Exp $ */ /*! \file */ @@ -6629,10 +6629,12 @@ rdataset_setadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, acache_cancelentry(rbtdb->common.mctx, newentry, &newcbarg); dns_acache_detachentry(&newentry); + } else { + dns_db_detachnode((dns_db_t *)rbtdb, &newcbarg->node); + dns_db_detach(&newcbarg->db); + isc_mem_put(rbtdb->common.mctx, newcbarg, + sizeof(*newcbarg)); } - dns_db_detachnode((dns_db_t *)rbtdb, &newcbarg->node); - dns_db_detach(&newcbarg->db); - isc_mem_put(rbtdb->common.mctx, newcbarg, sizeof(*newcbarg)); } return (result);