1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-20 14:39:02 +00:00

libdnet: Remove call to FreeLibrary after GetModuleHandle.

Per Windows API docs: "do not pass a handle returned by GetModuleHandle
to the FreeLibrary function. Doing so can cause a DLL module to be
unmapped prematurely."
This commit is contained in:
dmiller
2021-07-23 16:50:12 +00:00
parent 8bb25f535c
commit 9b36c5b2b8
2 changed files with 18 additions and 2 deletions

View File

@@ -2543,3 +2543,21 @@ index 1399db2..352da4c 100644
if (strcmp(name, a->AdapterName) == 0)
break;
}
o Remove call to FreeLibrary after GetModuleHandle. Windows API docs say:
"do not pass a handle returned by GetModuleHandle to the FreeLibrary function.
Doing so can cause a DLL module to be unmapped prematurely."
diff --git a/libdnet-stripped/src/route-win32.c b/libdnet-stripped/src/route-win32.c
index c69b29b..8a9d2bc 100644
--- a/libdnet-stripped/src/route-win32.c
+++ b/libdnet-stripped/src/route-win32.c
@@ -269,8 +269,6 @@ route_t *
route_close(route_t *r)
{
if (r != NULL) {
- if (r->iphlpapi != NULL)
- FreeLibrary(r->iphlpapi);
if (r->ipftable != NULL)
free(r->ipftable);
if (r->ipftable2 != NULL)

View File

@@ -269,8 +269,6 @@ route_t *
route_close(route_t *r)
{
if (r != NULL) {
if (r->iphlpapi != NULL)
FreeLibrary(r->iphlpapi);
if (r->ipftable != NULL)
free(r->ipftable);
if (r->ipftable2 != NULL)