Skip to content

Commit

Permalink
Fix not closing dll handle
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlin96069 committed Aug 30, 2023
1 parent 4c15ae1 commit 645127b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/interfaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ struct CServerPlugin* plugin_handler = NULL;
static inline void* Sys_GetProcAddress(const char* pModuleName,
const char* pName) {
HMODULE hModule = (HMODULE)GetModuleHandle(pModuleName);
return (void*)GetProcAddress(hModule, pName);
if (!hModule)
return NULL;

void* factory = (void*)GetProcAddress(hModule, pName);

CloseHandle(hModule);
return factory;
}

CreateInterfaceFn Sys_GetFactory(const char* pModuleName) {
Expand Down

0 comments on commit 645127b

Please sign in to comment.