From cad61731f8e960d9d99034a2a6eaafe1069c405c Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 9 Jan 2002 06:16:10 +0000 Subject: [PATCH] 1173. [bug] Potential leaks in isc_log_create() and isc_log_settag(). [RT #2336] --- CHANGES | 3 +++ lib/isc/log.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 4bb26844af..5d2ecbb3e2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +1173. [bug] Potential leaks in isc_log_create() and + isc_log_settag(). [RT #2336] + 1172. [doc] Add CERT, GPOS, KX, NAPTR, NSAP, PX and TXT to table of RR types in ARM. diff --git a/lib/isc/log.c b/lib/isc/log.c index b10000d2b2..4145f893f1 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.c,v 1.72 2001/11/30 01:59:34 gson Exp $ */ +/* $Id: log.c,v 1.73 2002/01/09 06:16:10 marka Exp $ */ /* Principal Authors: DCL */ @@ -302,9 +302,12 @@ isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp, isc_logconfig_t **lcfgp) { if (lcfgp != NULL) *lcfgp = lcfg; - } else + } else { + if (lcfg != NULL) + isc_logconfig_destroy(&lcfg); if (lctx != NULL) isc_log_destroy(&lctx); + } return (result); } @@ -980,6 +983,8 @@ isc_log_settag(isc_logconfig_t *lcfg, const char *tag) { REQUIRE(VALID_CONFIG(lcfg)); if (tag != NULL && *tag != '\0') { + if (lcfg->tag != NULL) + isc_mem_free(lcfg->lctx->mctx, lcfg->tag); lcfg->tag = isc_mem_strdup(lcfg->lctx->mctx, tag); if (lcfg->tag == NULL) return (ISC_R_NOMEMORY);