DJGPP: Avoid leaking memory on lowmem mapping error
Add a clarifying comment about why low memory is never unmapped.
Corresponding to flashrom svn r1195.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Rudolf Marek <r.marek@assembler.cz>
diff --git a/physmap.c b/physmap.c
index 011c8d1..d5948ae 100644
--- a/physmap.c
+++ b/physmap.c
@@ -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;
}