Fix crash when there is no LD_LIBRARY_PATH
authorCarl Hetherington <cth@carlh.net>
Wed, 22 Nov 2023 23:47:57 +0000 (00:47 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 16 Dec 2023 01:07:38 +0000 (02:07 +0100)
src/lib/util.cc

index a25914a6c6e99dc3c5df1df7ae6d5f0de06b753e..efe39c1c847edf76279a98dc8768c6c731629e06 100644 (file)
@@ -1125,7 +1125,10 @@ setup_grok_library_path()
 {
        static std::string old_path;
        if (old_path.empty()) {
-               old_path = getenv("LD_LIRARY_PATH");
+               auto const old = getenv("LD_LIRARY_PATH");
+               if (old) {
+                       old_path = old;
+               }
        }
        auto const grok = Config::instance()->grok();
        if (!grok || grok->binary_location.empty()) {