VirtualBox

Ignore:
Timestamp:
Feb 6, 2019 7:46:49 PM (6 years ago)
Author:
vboxsync
Message:

Runtime/common/ldr: Fix memory leak caused by missing unmapping calls

Location:
trunk/src/VBox/Runtime/common/ldr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h

    r76553 r77185  
    677677    }
    678678
    679     pModElf->pvBits = NULL;
     679    if (pModElf->pvBits)
     680    {
     681        pModElf->Core.pReader->pfnUnmap(pModElf->Core.pReader, pModElf->pvBits);
     682        pModElf->pvBits = NULL;
     683    }
    680684
    681685    return VINF_SUCCESS;
  • trunk/src/VBox/Runtime/common/ldr/ldrFile.cpp

    r76553 r77185  
    186186    int rc = VINF_SUCCESS;
    187187    PRTLDRREADERFILE pFileReader = (PRTLDRREADERFILE)pReader;
     188
     189    Assert(!pFileReader->cMappings);
     190
    188191    if (pFileReader->hFile != NIL_RTFILE)
    189192    {
     
    192195        pFileReader->hFile = NIL_RTFILE;
    193196    }
     197
     198    if (pFileReader->pvMapping)
     199    {
     200        RTMemFree(pFileReader->pvMapping);
     201        pFileReader->pvMapping = NULL;
     202    }
     203
    194204    RTMemFree(pFileReader);
    195205    return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette