Changeset 10459 for trunk/src


Ignore:
Timestamp:
Feb 13, 2004, 6:37:25 PM (22 years ago)
Author:
sandervl
Message:

Allocate memory for the map during CreateFileMapping and free it when the map is destroyed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/mmap.cpp

    r10377 r10459  
    1 /* $Id: mmap.cpp,v 1.67 2004-01-11 11:57:53 sandervl Exp $ */
     1/* $Id: mmap.cpp,v 1.68 2004-02-13 17:37:25 sandervl Exp $ */
    22
    33/*
     
    172172#endif
    173173    }
     174    // Allocate the memory for the map right now
     175    if(allocateMap() == FALSE) {
     176        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
     177        goto fail;
     178    }
    174179
    175180    dprintf(("CreateFileMappingA for file %x, prot %x size %d, name %s", hMemFile, mProtFlags, mSize, lpszMapName));
     
    196201    }
    197202    if(pMapping && !image) {
     203        dprintf(("Free map memory"));
    198204        if(lpszMapName) {
    199205                OSLibDosFreeMem(pMapping);
     
    727733    }
    728734
    729     if(allocateMap() == FALSE) {
    730         SetLastError(ERROR_NOT_ENOUGH_MEMORY);
    731         goto fail;
    732     }
    733 
    734735    mapview = new Win32MemMapView(this, offset, (size == 0) ? (mSize - offset) : size, fdwAccess);
    735736    if(mapview == NULL) {
     
    785786    delete view;
    786787
    787     if(nrMappings == 0) {
    788         VirtualFree(pMapping, 0, MEM_RELEASE);
    789         pMapping = NULL;
    790     }
    791788    mapMutex.leave();
    792789
Note: See TracChangeset for help on using the changeset viewer.