]> code.delx.au - refind/blobdiff - refind/config.c
Fix memory management error; version 0.6.4 release.
[refind] / refind / config.c
index 81f87dd648b3b9a852c719e29561c22142049510..12375c4868e04382d7009e5e4aac02b37a79df22 100644 (file)
@@ -348,15 +348,16 @@ VOID ReadConfig(CHAR16 *FileName)
     if (StriCmp(FileName, CONFIG_FILE_NAME) == 0) {
        MyFreePool(GlobalConfig.AlsoScan);
        GlobalConfig.AlsoScan = StrDuplicate(ALSO_SCAN_DIRS);
-//        MyFreePool(GlobalConfig.DontScanVolumes);
-//        GlobalConfig.DontScanVolumes = StrDuplicate(L" ");
        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);