Skip to content

Commit 96624e6

Browse files
committed
Fix dlerror() usage
1 parent 35a1c68 commit 96624e6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/utils/utils_load_library.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ void *utils_open_library(const char *filename, int userFlags) {
7676

7777
void *handle = dlopen(filename, dlopenFlags);
7878
if (handle == NULL) {
79-
LOG_FATAL("dlopen(%s) failed with error: %s", filename, dlerror());
79+
char *error_str = dlerror();
80+
LOG_FATAL("dlopen(%s) failed with error: %s", filename, error_str);
8081
}
8182

8283
return handle;
@@ -93,7 +94,8 @@ void *utils_get_symbol_addr(void *handle, const char *symbol,
9394

9495
void *addr = dlsym(handle, symbol);
9596
if (addr == NULL) {
96-
LOG_ERR("required symbol not found: %s (error: %s)", symbol, dlerror());
97+
char *error_str = dlerror();
98+
LOG_ERR("required symbol not found: %s (error: %s)", symbol, error_str);
9799
}
98100

99101
return addr;

0 commit comments

Comments
 (0)