mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Fix memory/socket leak in UniqueId::ethernetMacAddress()
Don't jump over `close()`/`free()`
This commit is contained in:
parent
aab47091b1
commit
a17193f7af
@ -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