]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove unnecessary NULL checks in parser.c
authorMark Andrews <marka@isc.org>
Sun, 26 Oct 2025 23:35:35 +0000 (10:35 +1100)
committerMark Andrews <marka@isc.org>
Mon, 27 Oct 2025 19:28:52 +0000 (06:28 +1100)
In cfg_parse_buffer and cfg_parse_file 'pctx' was being checked
for being non-NULL when it was guarenteed to be non-NULL.  This
raised Coverity issues ID 637688 and ID 637689.

lib/isccfg/parser.c

index f5e2dbffd93e14c6344d622494254c94eb292576..011d8305137d603a7cd669aaf3632fb51bd32056 100644 (file)
@@ -675,9 +675,7 @@ cfg_parse_file(isc_mem_t *mctx, const char *filename, const cfg_type_t *type,
        ISC_LIST_APPEND(pctx->closed_files->value.list, elt, link);
 
 cleanup:
-       if (pctx != NULL) {
-               parser_destroy(&pctx);
-       }
+       parser_destroy(&pctx);
 
        return result;
 }
@@ -709,9 +707,7 @@ cfg_parse_buffer(isc_mem_t *mctx, isc_buffer_t *buffer, const char *file,
        pctx->buf_name = NULL;
 
 cleanup:
-       if (pctx != NULL) {
-               parser_destroy(&pctx);
-       }
+       parser_destroy(&pctx);
 
        return result;
 }