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
Index: flashrom-djgpp_physmap_noleaks/physmap.c =================================================================== --- flashrom-djgpp_physmap_noleaks/physmap.c (Revision 1194) +++ flashrom-djgpp_physmap_noleaks/physmap.c (Arbeitskopie) @@ -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; }