2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

2949. [bug] dns_view_setnewzones() contained a memory leak if

it was called multiple times. [RT #21942]
This commit is contained in:
Mark Andrews
2010-09-06 04:31:11 +00:00
parent 3045036e49
commit 02a211f4c4
2 changed files with 14 additions and 11 deletions

View File

@@ -1,3 +1,6 @@
2949. [bug] dns_view_setnewzones() contained a memory leak if
it was called multiple times. [RT #21942]
2948. [port] MacOS: provide a mechanism to configure the test
interfaces at reboot. See bin/tests/system/README
for details.

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: view.c,v 1.168 2010/08/12 04:04:14 each Exp $ */
/* $Id: view.c,v 1.169 2010/09/06 04:31:11 marka Exp $ */
/*! \file */
@@ -1635,6 +1635,16 @@ dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx,
REQUIRE((cfgctx != NULL && cfg_destroy != NULL) || !allow);
#ifdef BIND9
if (view->new_zone_file != NULL) {
isc_mem_free(view->mctx, view->new_zone_file);
view->new_zone_file = NULL;
}
if (view->new_zone_config != NULL) {
view->cfg_destroy(&view->new_zone_config);
view->cfg_destroy = NULL;
}
if (allow) {
char buffer[ISC_SHA256_DIGESTSTRINGLENGTH + sizeof(NZF)];
isc_sha256_data((void *)view->name, strlen(view->name), buffer);
@@ -1643,16 +1653,6 @@ dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx,
view->new_zone_file = isc_mem_strdup(view->mctx, buffer);
view->new_zone_config = cfgctx;
view->cfg_destroy = cfg_destroy;
} else {
if (view->new_zone_file != NULL) {
isc_mem_free(view->mctx, view->new_zone_file);
view->new_zone_file = NULL;
}
if (view->new_zone_config != NULL) {
view->cfg_destroy(&view->new_zone_config);
view->cfg_destroy = NULL;
}
}
#else
UNUSED(allow);