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==
{
   <insert_a_suppression_name_here>
   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:
This commit is contained in:
niftynei
2022-07-25 14:15:33 -05:00
committed by neil saitug
parent f4abc3a661
commit 282ab72e2d
2 changed files with 3 additions and 0 deletions

View File

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

View File

@@ -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);