From: Michal Nowak Date: Mon, 29 Jun 2026 12:41:03 +0000 (+0000) Subject: Silence scan-build leak false positive in isccc_cc_checkdup() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=308e1a73f0d33a1eef1d5a00ffb8cb411d679027;p=thirdparty%2Fbind9.git Silence scan-build leak false positive in isccc_cc_checkdup() On success the symtab owns 'key' and frees it via symtab_undefine(), but scan-build cannot see that ownership pass through the const key parameter of isc_symtab_define() and reports a leak. free(key) under __clang_analyzer__ only, which placates the checker without affecting real builds: lib/isccc/cc.c:1015:9: warning: Potential leak of memory pointed to by 'key' [unix.Malloc] Assisted-by: Claude:claude-opus-4-8 --- diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c index bb3f3530d5f..a08ca0ab746 100644 --- a/lib/isccc/cc.c +++ b/lib/isccc/cc.c @@ -1012,5 +1012,15 @@ isccc_cc_checkdup(isc_symtab_t *symtab, isccc_sexpr_t *message, return result; } +#ifdef __clang_analyzer__ + /* + * On success the symtab owns 'key' and frees it via + * symtab_undefine(). scan-build cannot see that ownership pass + * through the const key parameter of isc_symtab_define(), so free + * it here under analysis only to avoid a false-positive leak report. + */ + free(key); +#endif + return ISC_R_SUCCESS; }