]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1173. [bug] Potential leaks in isc_log_create() and
authorMark Andrews <marka@isc.org>
Wed, 9 Jan 2002 06:16:10 +0000 (06:16 +0000)
committerMark Andrews <marka@isc.org>
Wed, 9 Jan 2002 06:16:10 +0000 (06:16 +0000)
                        isc_log_settag(). [RT #2336]

CHANGES
lib/isc/log.c

diff --git a/CHANGES b/CHANGES
index 4bb26844af2802064b02311c8f1e39832c167227..5d2ecbb3e2337ee928f6d4f3e4dc1e140cd459d3 100644 (file)
--- 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.
 
index b10000d2b25e9f566bcf092b7d7388f55477ead9..4145f893f15c5d97ebfb70df5b3363e0d71e37e0 100644 (file)
@@ -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);