From: Azat Khuzhin Date: Fri, 28 Aug 2020 22:15:20 +0000 (+0300) Subject: test/regress_dns: fix -Wmaybe-uninitialized X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2338f27e694f74931022e3310f629504f7ebbe8e;p=libevent test/regress_dns: fix -Wmaybe-uninitialized Was not noticed since it is reported only with optimization enabled, as stated in gcc(1): The effectiveness of some warnings depends on optimizations also being enabled. For example -Wsuggest-final-types is more effective with link-time optimization and -Wmaybe-uninitialized does not warn at all unless optimization is enabled. And interesting thing is that it is reported only for -O2, not for -O3, that's why I did not catched it in both cmake env that I had: - debug (it has -O0) - release (it has -O3) While autoconf has -O2. --- diff --git a/test/regress_dns.c b/test/regress_dns.c index f97e755d..4e3d6f16 100644 --- a/test/regress_dns.c +++ b/test/regress_dns.c @@ -1314,7 +1314,7 @@ test_bufferevent_connect_hostname(void *arg) int emfile = data->setup_data && !strcmp(data->setup_data, "emfile"); int hints = data->setup_data && !strcmp(data->setup_data, "hints"); struct evconnlistener *listener = NULL; - struct bufferevent *be[5]; + struct bufferevent *be[5] = { NULL, NULL, NULL, NULL, NULL }; struct be_conn_hostname_result be_outcome[ARRAY_SIZE(be)]; int expect_err; struct evdns_base *dns=NULL;