]> code.delx.au - refind/blobdiff - refind/config.c
Fix memory management error; version 0.6.4 release.
[refind] / refind / config.c
index 99b9f7a8f88c655881c46b33f354d9530791a6d1..12375c4868e04382d7009e5e4aac02b37a79df22 100644 (file)
@@ -349,12 +349,15 @@ VOID ReadConfig(CHAR16 *FileName)
        MyFreePool(GlobalConfig.AlsoScan);
        GlobalConfig.AlsoScan = StrDuplicate(ALSO_SCAN_DIRS);
        MyFreePool(GlobalConfig.DontScanDirs);
-       if (SelfVolume->VolName) {
-          SelfPath = StrDuplicate(SelfVolume->VolName);
-       } else {
-          SelfPath = AllocateZeroPool(256 * sizeof(CHAR16));
-          SPrint(SelfPath, 255, L"fs%d", SelfVolume->VolNumber);
-       } // if/else
+       if (SelfVolume) {
+          if (SelfVolume->VolName) {
+             SelfPath = StrDuplicate(SelfVolume->VolName);
+          } else {
+             SelfPath = AllocateZeroPool(256 * sizeof(CHAR16));
+             if (SelfPath != NULL)
+                SPrint(SelfPath, 255, L"fs%d", SelfVolume->VolNumber);
+          } // if/else
+       }
        MergeStrings(&SelfPath, SelfDirPath, L':');
        GlobalConfig.DontScanDirs = SelfPath;
        MyFreePool(GlobalConfig.DontScanFiles);