From 282ab72e2da5462cc431ed86f78b3c235aef91b1 Mon Sep 17 00:00:00 2001 From: niftynei Date: Mon, 25 Jul 2022 14:15:33 -0500 Subject: [PATCH] tests: valgrind barfing on uninitialized value ------------------------------- Valgrind errors -------------------------------- Valgrind error file: valgrind-errors.493330 ==493330== Conditional jump or move depends on uninitialised value(s) ==493330== at 0x154051: opt_add_addr_withtype (options.c:275) ==493330== by 0x154406: opt_add_announce_addr (options.c:302) ==493330== by 0x2696E6: parse_one (parse.c:121) ==493330== by 0x25CFB5: opt_parse (opt.c:228) ==493330== by 0x155DB6: handle_opts (options.c:1413) ==493330== by 0x127317: main (lightningd.c:994) ==493330== { Memcheck:Cond fun:opt_add_addr_withtype fun:opt_add_announce_addr fun:parse_one fun:opt_parse fun:handle_opts fun:main } -------------------------------------------------------------------------------- Leaving base_dir /tmp/ltests-iyf2dw3n intact, it still has test sub-directories with failure details: ['test_announce_dns_without_port_1'] ====================================== short test summary info ====================================== ERROR tests/test_gossip.py::test_announce_dns_without_port - ValueError: --- common/wireaddr.c | 1 + lightningd/options.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/common/wireaddr.c b/common/wireaddr.c index f43368400..4246a460c 100644 --- a/common/wireaddr.c +++ b/common/wireaddr.c @@ -337,6 +337,7 @@ bool separate_address_and_port(const tal_t *ctx, const char *arg, *port = strtol(portcolon + 1, &endp, 10); return *port != 0 && *endp == '\0'; } + return true; } diff --git a/lightningd/options.c b/lightningd/options.c index 45a01ca45..be6c159c4 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -226,6 +226,8 @@ static char *opt_add_addr_withtype(const char *arg, assert(arg != NULL); dns_ok = !ld->always_use_proxy && ld->config.use_dns; + /* Will be overridden in next call iff has port */ + port = 0; if (!separate_address_and_port(tmpctx, arg, &address, &port)) return tal_fmt(NULL, "Unable to parse address:port '%s'", arg);