From 0a7e6211df8188d78bc4a7b6db7e877ff3562f32 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 6 Mar 2024 13:54:21 +1030 Subject: [PATCH] common: fix uninitialized member in gossmap. Wrote a test program which passed num_channel_updates_rejected as NULL (which we don't usually do), and valgrind complained: ``` ==1048302== Conditional jump or move depends on uninitialised value(s) ==1048302== at 0x118B90: update_channel (gossmap.c:550) ==1048302== by 0x119EEE: map_catchup (gossmap.c:663) ==1048302== by 0x11A299: load_gossip_store (gossmap.c:726) ==1048302== by 0x11A352: gossmap_load (gossmap.c:1052) ==1048302== by 0x125362: main (run-route-infloop.c:90) ``` Signed-off-by: Rusty Russell --- common/gossmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/gossmap.c b/common/gossmap.c index a4f6fa6bd..8a420c31e 100644 --- a/common/gossmap.c +++ b/common/gossmap.c @@ -1046,7 +1046,8 @@ struct gossmap *gossmap_load(const tal_t *ctx, const char *filename, *num_channel_updates_rejected = 0; map->cupdate_fail = cupdate_fail_inc_ctr; map->cb_arg = num_channel_updates_rejected; - } + } else + map->cupdate_fail = NULL; map->unknown_record = NULL; if (!load_gossip_store(map))