mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 13:26:01 +03:00
Merge pull request #3392 from amezin/macaddr-resource-leak
Fix memory/socket leak in `UniqueId::ethernetMacAddress()`
This commit is contained in:
commit
31507404e6
@ -134,7 +134,7 @@ std::string UniqueId::ethernetMacAddress() {
|
|||||||
(unsigned char)LLADDR(sdl)[3],
|
(unsigned char)LLADDR(sdl)[3],
|
||||||
(unsigned char)LLADDR(sdl)[4],
|
(unsigned char)LLADDR(sdl)[4],
|
||||||
(unsigned char)LLADDR(sdl)[5]);
|
(unsigned char)LLADDR(sdl)[5]);
|
||||||
goto end;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ std::string UniqueId::ethernetMacAddress() {
|
|||||||
(unsigned char)ifr->ifr_addr.sa_data[4],
|
(unsigned char)ifr->ifr_addr.sa_data[4],
|
||||||
(unsigned char)ifr->ifr_addr.sa_data[5]);
|
(unsigned char)ifr->ifr_addr.sa_data[5]);
|
||||||
|
|
||||||
goto end;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(sock);
|
close(sock);
|
||||||
@ -219,7 +219,7 @@ std::string UniqueId::ethernetMacAddress() {
|
|||||||
(unsigned char)pAdapter->Address[3],
|
(unsigned char)pAdapter->Address[3],
|
||||||
(unsigned char)pAdapter->Address[4],
|
(unsigned char)pAdapter->Address[4],
|
||||||
(unsigned char)pAdapter->Address[5]);
|
(unsigned char)pAdapter->Address[5]);
|
||||||
goto end;
|
break;
|
||||||
}
|
}
|
||||||
pAdapter = pAdapter->Next;
|
pAdapter = pAdapter->Next;
|
||||||
}
|
}
|
||||||
@ -227,9 +227,6 @@ std::string UniqueId::ethernetMacAddress() {
|
|||||||
free(pAdapterInfo);
|
free(pAdapterInfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__gnu_linux__) || defined(DARWIN) || defined(WIN32)
|
|
||||||
end:
|
|
||||||
#endif
|
|
||||||
return std::string(reinterpret_cast<const char *>(mac));
|
return std::string(reinterpret_cast<const char *>(mac));
|
||||||
#if defined(__linux__) || defined(__gnu_linux__) || defined(DARWIN) || defined(WIN32)
|
#if defined(__linux__) || defined(__gnu_linux__) || defined(DARWIN) || defined(WIN32)
|
||||||
failed:
|
failed:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user