Author: hailfinger Date: Wed Oct 6 01:21:51 2010 New Revision: 1195 URL: http://flashrom.org/trac/flashrom/changeset/1195
Log: DJGPP: Avoid leaking memory on lowmem mapping error. Add a clarifying comment about why low memory is never unmapped.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net Acked-by: Rudolf Marek r.marek@assembler.cz
Modified: trunk/physmap.c
Modified: trunk/physmap.c ============================================================================== --- trunk/physmap.c Wed Oct 6 00:29:08 2010 (r1194) +++ trunk/physmap.c Wed Oct 6 01:21:51 2010 (r1195) @@ -56,6 +56,8 @@ }
if (__djgpp_map_physical_memory(realmem_map, (1024 * 1024), 0)) { + free(realmem_map); + realmem_map = NULL; return ERROR_PTR; }
@@ -95,7 +97,9 @@ { __dpmi_meminfo mi;
- /* we ignore unmaps for our first 1MB */ + /* There is no known way to unmap the first 1 MB. The DPMI server will + * do this for us on exit. + */ if ((virt_addr >= realmem_map) && ((virt_addr + len) <= (realmem_map + (1024 * 1024)))) { return; }