From: Arran Cudbard-Bell Date: Sat, 10 Dec 2022 15:55:42 +0000 (-0600) Subject: Fix crash on start introduced by 181ae63889075fd475f007c62eabc78ac9e83265 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4723d12a5230cc47f7946672d6b2a98d64b3ce4;p=thirdparty%2Ffreeradius-server.git Fix crash on start introduced by 181ae63889075fd475f007c62eabc78ac9e83265 --- diff --git a/src/lib/util/dl.c b/src/lib/util/dl.c index fb6085c89c2..5a94f826e05 100644 --- a/src/lib/util/dl.c +++ b/src/lib/util/dl.c @@ -523,13 +523,12 @@ dl_t *dl_by_name(dl_loader_t *dl_loader, char const *name, void *uctx, bool uctx if (search_path) { char *ctx, *paths, *path; char *p; + char *dlerror_txt = NULL; fr_strerror_clear(); ctx = paths = talloc_typed_strdup(NULL, search_path); while ((path = strsep(&paths, ":")) != NULL) { - char *dlerror_txt; - /* * Trim the trailing slash */ @@ -592,7 +591,12 @@ dl_t *dl_by_name(dl_loader_t *dl_loader, char const *name, void *uctx, bool uctx */ if (!handle) { talloc_free(ctx); - fr_strerror_printf("%s", dlerror()); + /* + * We're reliant on dlerror_txt from the loop, + * because once dlerror() is called the error + * is cleared. + */ + fr_strerror_printf("%s", dlerror_txt ? dlerror_txt : "unknown dlopen error"); return NULL; }