mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-05 09:14:03 +00:00
Zero out a local variable also when PURIFY is not defined.
This silence a warning brought up by valgrind whenever if_nametoindex is used. This was already discussed in PR 166483, but the code committed in r234329 guards the initilization with #ifdef PURIFY. Therefore, valgrind still complains. Since this code is not performance critical, always zero out the local variable to silence valgrind. PR: 166483 Discussed with: eadler@ MFC after: 4 weeks
This commit is contained in:
parent
3f326305fc
commit
14914827f0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=287619
@ -70,9 +70,7 @@ if_nametoindex(const char *ifname)
|
||||
|
||||
s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
|
||||
if (s != -1) {
|
||||
#ifdef PURIFY
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
#endif
|
||||
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
|
||||
if (_ioctl(s, SIOCGIFINDEX, &ifr) != -1) {
|
||||
_close(s);
|
||||
|
Loading…
Reference in New Issue
Block a user