From bb0e4c5601ad85610478634f1aa439807e42a699 Mon Sep 17 00:00:00 2001 From: Jim Huang Date: Wed, 1 Oct 2025 01:29:53 +0800 Subject: [PATCH] Fix -Werror=maybe-uninitialized warning GCC with AddressSanitizer reports that pathp in map_insert() may be used uninitialized: src/map.c:593:15: error: pathp may be used uninitialized 593 | for (pathp--; (uintptr_t) pathp >= (uintptr_t) path; pathp--) While the program logic ensures pathp is always initialized through rb_insert_unique() before use, static analysis cannot prove this due to the pointer-to-pointer assignment pattern. Initialize to NULL to satisfy the compiler and improve defensive programming. --- src/map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map.c b/src/map.c index 8b76f692..7faaeece 100644 --- a/src/map.c +++ b/src/map.c @@ -572,7 +572,7 @@ bool map_insert(map_t obj, const void *key, const void *val) return false; rb_path_entry_t path[RB_MAX_DEPTH]; - rb_path_entry_t *pathp; + rb_path_entry_t *pathp = NULL; /* Single traversal to check existence and get insertion point */ const map_node_t *existing = rb_insert_unique(obj, key, path, &pathp);