]> granicus.if.org Git - libevent/commitdiff
test/regress_dns: fix -Wmaybe-uninitialized
authorAzat Khuzhin <azat@libevent.org>
Fri, 28 Aug 2020 22:15:20 +0000 (01:15 +0300)
committerAzat Khuzhin <azat@libevent.org>
Fri, 28 Aug 2020 22:15:20 +0000 (01:15 +0300)
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.

test/regress_dns.c

index f97e755dbbad32101aa91040904f4343bf7059f8..4e3d6f165268f82cb4e9194d15591a59fd6c01dc 100644 (file)
@@ -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;