diff options
| author | Pali Rohár <pali.rohar@gmail.com> | 2023-12-02 16:30:22 +0100 |
|---|---|---|
| committer | Silvio <silvio.traversaro@iit.it> | 2025-04-28 14:49:51 +0200 |
| commit | 3b735be29deae48aea3b30d84fda040501600ce9 (patch) | |
| tree | abd56701ffbfbf989c342a9b261e285ba651ed1d /src | |
| parent | 3b52e651f385df00045dd8966407fd9de57fc94b (diff) | |
| download | dlfcn-win32-3b735be29deae48aea3b30d84fda040501600ce9.tar.gz dlfcn-win32-3b735be29deae48aea3b30d84fda040501600ce9.tar.bz2 dlfcn-win32-3b735be29deae48aea3b30d84fda040501600ce9.zip | |
Fix dlclose() for dlopen(NULL, ...)
dlopen(NULL, ...) does not call LoadLibrary(), so do not call FreeLibrary()
in dlclose() for this case.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dlfcn.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dlfcn.c b/src/dlfcn.c index cb9f9bb..be6e01f 100644 --- a/src/dlfcn.c +++ b/src/dlfcn.c | |||
| @@ -466,6 +466,10 @@ int dlclose( void *handle ) | |||
| 466 | 466 | ||
| 467 | error_occurred = FALSE; | 467 | error_occurred = FALSE; |
| 468 | 468 | ||
| 469 | /* dlopen(NULL, ...) does not call LoadLibrary(), so do not call FreeLibrary(). */ | ||
| 470 | if( hModule == GetModuleHandle( NULL ) ) | ||
| 471 | return 0; | ||
| 472 | |||
| 469 | ret = FreeLibrary( hModule ); | 473 | ret = FreeLibrary( hModule ); |
| 470 | 474 | ||
| 471 | /* If the object was loaded with RTLD_LOCAL, remove it from list of local | 475 | /* If the object was loaded with RTLD_LOCAL, remove it from list of local |
