]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
840. [bug] The config file parser could print the wrong file
authorBrian Wellington <source@isc.org>
Mon, 28 May 2001 06:05:24 +0000 (06:05 +0000)
committerBrian Wellington <source@isc.org>
Mon, 28 May 2001 06:05:24 +0000 (06:05 +0000)
name if an error was detected after an included file
was parsed. [RT #1353]

CHANGES
lib/isccfg/parser.c

diff --git a/CHANGES b/CHANGES
index 7b564627e1b175ec403f927c7865ec49deaf779d..8a5348e2549be57215646b9801d5fad1fc38a7bf 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+ 840.  [bug]           The config file parser could print the wrong file
+                       name if an error was detected after an included file
+                       was parsed. [RT #1353]
+
  839.  [func]          Dump packets for which there was no view or that the
                        class could not be determined to category "unmatched".
 
index 4a6e9e20631ec3fd2e11209220aa975fb04579f7..3f02dfc50be701693879ca914c6a5878077d451d 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: parser.c,v 1.52 2001/05/09 03:17:02 gson Exp $ */
+/* $Id: parser.c,v 1.53 2001/05/28 06:05:24 bwelling Exp $ */
 
 #include <config.h>
 
@@ -2010,6 +2010,12 @@ create_listelt(cfg_parser_t *pctx, cfg_listelt_t **eltp) {
        return (ISC_R_SUCCESS);
 }
 
+static void
+free_list_elt(cfg_parser_t *pctx, cfg_listelt_t *elt) {
+       cfg_obj_destroy(pctx, &elt->obj);
+       isc_mem_put(pctx->mctx, elt, sizeof(*elt));
+}
+
 static void
 free_list(cfg_parser_t *pctx, cfg_obj_t *obj) {
        cfg_listelt_t *elt, *next;
@@ -2018,8 +2024,7 @@ free_list(cfg_parser_t *pctx, cfg_obj_t *obj) {
             elt = next)
        {
                next = ISC_LIST_NEXT(elt, link);
-               cfg_obj_destroy(pctx, &elt->obj);
-               isc_mem_put(pctx->mctx, elt, sizeof(*elt));
+               free_list_elt(pctx, elt);
        }
 }
 
@@ -3459,6 +3464,12 @@ cfg_gettoken(cfg_parser_t *pctx, int options) {
                                /*
                                 * Closed an included file, not the main file.
                                 */
+                               cfg_listelt_t *elt;
+                               elt = ISC_LIST_TAIL(pctx->files->value.list);
+                               INSIST(elt != NULL);
+                               ISC_LIST_UNLINK(pctx->files->value.list,
+                                               elt, link);
+                               free_list_elt(pctx, elt);
                                goto redo;
                        }
                        pctx->seen_eof = ISC_TRUE;