From 78ef30b5ffcc89515279348f9c2b38150847b691 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 3 May 2019 11:44:33 +0930 Subject: [PATCH] devtools/create-gossipstore: fix false cppcheck warning. [devtools/create-gossipstore.c:153]: (error) Uninitialized variable: scidsats scidsats access is gated by csvfile, which means this warning is a false positive. However, it's cleaner to gate scidsts on itself, rather than the cmdline option which caused it to be populated, so do that. Signed-off-by: Rusty Russell --- devtools/create-gossipstore.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/devtools/create-gossipstore.c b/devtools/create-gossipstore.c index 516e9fd0f..1bc1f177d 100644 --- a/devtools/create-gossipstore.c +++ b/devtools/create-gossipstore.c @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) bool verbose = false; char *infile = NULL, *outfile = NULL, *csvfile = NULL, *csat = NULL; int infd, outfd, scidi = 0, channels = 0, nodes = 0, updates = 0; - struct scidsat *scidsats; + struct scidsat *scidsats = NULL; unsigned max = -1U; setup_locale(); @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) switch (fromwire_peektype(inmsg)) { case WIRE_CHANNEL_ANNOUNCEMENT: - if (csvfile) { + if (scidsats) { struct short_channel_id scid; /* We ignore these; we just want scid */ secp256k1_ecdsa_signature sig; @@ -187,7 +187,6 @@ int main(int argc, char *argv[]) break; } fprintf(stderr, "channels %d, updates %d, nodes %d\n", channels, updates, nodes); - if (csvfile) - tal_free(scidsats); + tal_free(scidsats); return 0; }