]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1473. [bug] create_map() and create_string() failed to handle out
authorMark Andrews <marka@isc.org>
Thu, 3 Jul 2003 00:43:28 +0000 (00:43 +0000)
committerMark Andrews <marka@isc.org>
Thu, 3 Jul 2003 00:43:28 +0000 (00:43 +0000)
                        of memory cleanup.  [RT #6813]

CHANGES
lib/isccfg/parser.c

diff --git a/CHANGES b/CHANGES
index 0ea05c51a6096fb887e30baec7d34f84c16c5d6d..b48773d4557c4a960bb5abed0924ea744f14ab43 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -11,7 +11,7 @@
 1474.  [port]          Provide strtoul() and memmove() for platforms
                        without them.
 
-1473.  [bug]           free_map() and free_string() failed to handle out
+1473.  [bug]           create_map() and create_string() failed to handle out
                        of memory cleanup.  [RT #6813]
 
 1472.  [contrib]       idnkit-1.0 from JPNIC, replaces mdnkit.
index 36ca35c0a943339fea8f1251d5bc68708f927692..2c4e43557343f09e658ad16163030c5e3ec1396b 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: parser.c,v 1.108 2003/06/20 02:50:48 marka Exp $ */
+/* $Id: parser.c,v 1.109 2003/07/03 00:43:28 marka Exp $ */
 
 #include <config.h>
 
@@ -674,7 +674,7 @@ create_string(cfg_parser_t *pctx, const char *contents, const cfg_type_t *type,
        obj->value.string.length = len;
        obj->value.string.base = isc_mem_get(pctx->mctx, len + 1);
        if (obj->value.string.base == 0) {
-               CLEANUP_OBJ(obj);
+               isc_mem_put(pctx->mctx, obj, sizeof(*obj));
                return (ISC_R_NOMEMORY);
        }
        memcpy(obj->value.string.base, contents, len);
@@ -793,9 +793,8 @@ print_qstring(cfg_printer_t *pctx, cfg_obj_t *obj) {
 
 static void
 free_string(cfg_parser_t *pctx, cfg_obj_t *obj) {
-       if (obj->value.string.base != NULL)
-               isc_mem_put(pctx->mctx, obj->value.string.base,
-                           obj->value.string.length + 1);
+       isc_mem_put(pctx->mctx, obj->value.string.base,
+                   obj->value.string.length + 1);
 }
 
 isc_boolean_t
@@ -2226,14 +2225,14 @@ create_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
        return (ISC_R_SUCCESS);
 
  cleanup:
-       CLEANUP_OBJ(obj);
+       if (obj != NULL)
+               isc_mem_put(pctx->mctx, obj, sizeof(*obj));
        return (result);
 }
 
 static void
 free_map(cfg_parser_t *pctx, cfg_obj_t *obj) {
-       if (obj->value.map.id != NULL)
-               CLEANUP_OBJ(obj->value.map.id);
+       CLEANUP_OBJ(obj->value.map.id);
        isc_symtab_destroy(&obj->value.map.symtab);
 }