]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup:
authorAndreas Gustafsson <source@isc.org>
Wed, 23 Jan 2002 01:31:15 +0000 (01:31 +0000)
committerAndreas Gustafsson <source@isc.org>
Wed, 23 Jan 2002 01:31:15 +0000 (01:31 +0000)
1173.   [bug]           Potential memory leaks in isc_log_create() and
                        isc_log_settag(). [RT #2336]

CHANGES
lib/isc/log.c

diff --git a/CHANGES b/CHANGES
index b6bc8d494472fe4d8f5dc607eda04fb5244b31a8..b2ab178e4cda845b71cce71dd33ccd4570d911bc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,9 @@
 1174.  [bug]           Win32: add WSAECONNRESET to the expected errors
                        from connect(). [RT #2308]
 
+1173.  [bug]           Potential memory leaks in isc_log_create() and
+                       isc_log_settag(). [RT #2336]
+
 1165.  [bug]           We were rejecting notify-source{-v6} in zone clauses.
 
 1164.  [bug]           Empty masters clauses in slave / stub zones were not
index b96bff6e6ab3eeda233650914e5472858d9cc6c5..49ce5007fa4ccf2eb1c2c79505f15c31f4c89aaa 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: log.c,v 1.70.2.1 2001/09/05 00:38:03 gson Exp $ */
+/* $Id: log.c,v 1.70.2.2 2002/01/23 01:31:15 gson 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);