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
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;
}