From ff18ffe3141c5fcfe1cc23fc279a095292a39443 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 9 Dec 2003 21:10:31 +0000 Subject: [PATCH] Fixed possible bug in xms with handlecount Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1477 --- src/ints/xms.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ints/xms.cpp b/src/ints/xms.cpp index a02177c6..854e099c 100644 --- a/src/ints/xms.cpp +++ b/src/ints/xms.cpp @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $Id: xms.cpp,v 1.29 2003-12-09 21:10:31 qbix79 Exp $ */ + #include #include #include "dosbox.h" @@ -120,7 +122,7 @@ Bitu XMS_AllocateMemory(Bitu size, Bit16u& handle) /* Find free handle */ Bit16u index=1; while (!xms_handles[index].free) { - if (++index>XMS_HANDLES) return XMS_OUT_OF_HANDLES; + if (++index>=XMS_HANDLES) return XMS_OUT_OF_HANDLES; } Bitu pages=(size/4) + ((size & 3) ? 1 : 0); MemHandle mem=MEM_AllocatePages(pages,true);