monitor: Fix valgrind warning

==24195== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
==24195==    at 0x4F3DBEF: sendto (in /lib64/libc-2.26.so)
==24195==    by 0x13A453: can_write_data (netlink.c:119)
==24195==    by 0x13866B: io_callback (io.c:149)
==24195==    by 0x137365: l_main_iterate (main.c:389)
==24195==    by 0x1374A3: l_main_run (main.c:436)
==24195==    by 0x113524: main (main.c:832)
==24195==  Address 0x5205f99 is 57 bytes inside a block of size 88 alloc'd
==24195==    at 0x4C2D0AF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==24195==    by 0x133931: l_malloc (util.c:62)
==24195==    by 0x13AEF3: l_netlink_send (netlink.c:411)
==24195==    by 0x112351: rtm_interface_send_message (main.c:276)
==24195==    by 0x1126F3: iwmon_interface_lookup (main.c:405)
==24195==    by 0x11351F: main (main.c:830)
==24195==  Uninitialised value was created by a heap allocation
==24195==    at 0x4C2D0AF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==24195==    by 0x133931: l_malloc (util.c:62)
==24195==    by 0x11217B: rtm_interface_send_message (main.c:234)
==24195==    by 0x1126F3: iwmon_interface_lookup (main.c:405)
==24195==    by 0x11351F: main (main.c:830)
This commit is contained in:
Denis Kenzior 2018-10-30 17:52:24 -05:00
parent 7699c8ab1e
commit ec365e52eb
1 changed files with 1 additions and 0 deletions

View File

@ -221,6 +221,7 @@ static struct l_netlink *rtm_interface_send_message(struct l_netlink *rtnl,
RTA_SPACE(nlmon_type_len);
rtmmsg = l_malloc(bufsize);
memset(rtmmsg, 0, bufsize);
rtmmsg->ifi_family = AF_UNSPEC;
rtmmsg->ifi_change = ~0;