ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/main_unix.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/main_unix.cpp (file contents):
Revision 1.16 by cebix, 2000-07-22T18:12:34Z vs.
Revision 1.17 by cebix, 2000-07-24T15:17:07Z

# Line 301 | Line 301 | int main(int argc, char **argv)
301      for (int i=0; i<0x80000; i+=4096)
302          mmap(good_address_map + i + 0x00400000, 4096, PROT_READ, MAP_FIXED | MAP_PRIVATE, good_address_fd, 0);
303   #else
304 <        RAMBaseHost = new uint8[RAMSize];
305 <        ROMBaseHost = new uint8[0x100000];
304 >        RAMBaseHost = (uint8 *)malloc(RAMSize);
305 >        ROMBaseHost = (uint8 *)malloc(0x100000);
306   #endif
307 +        if (RAMBaseHost == NULL || ROMBaseHost == NULL) {
308 +                ErrorAlert(GetString(STR_NO_MEM_ERR));
309 +                QuitEmulator();
310 +        }
311   #if REAL_ADDRESSING && !EMULATED_68K
312          RAMBaseMac = (uint32)RAMBaseHost;
313          ROMBaseMac = (uint32)ROMBaseHost;
# Line 561 | Line 565 | void QuitEmulator(void)
565          ExitAll();
566  
567          // Delete ROM area
568 <        delete[] ROMBaseHost;
568 >        if (ROMBaseHost) {
569 >                free(ROMBaseHost);
570 >                ROMBaseHost = NULL;
571 >        }
572  
573          // Delete RAM area
574 <        delete[] RAMBaseHost;
574 >        if (RAMBaseHost) {
575 >                free(RAMBaseHost);
576 >                RAMBaseHost = NULL;
577 >        }
578  
579   #if !EMULATED_68K
580          // Delete scratch memory area
581 <        if (ScratchMem)
581 >        if (ScratchMem) {
582                  free((void *)(ScratchMem - SCRATCH_MEM_SIZE/2));
583 +                ScratchMem = NULL;
584 +        }
585   #endif
586  
587   #if REAL_ADDRESSING

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines