mirror of
				https://github.com/FDOS/kernel.git
				synced 2025-10-31 03:14:40 +01:00 
			
		
		
		
	Compatibility fix for QB4.0(+?)
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1259 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
		
							parent
							
								
									0b892e8479
								
							
						
					
					
						commit
						3b6ba941b9
					
				| @ -38,8 +38,10 @@ static BYTE *memmgrRcsId = | |||||||
| #define nxtMCB(mcb) nxtMCBsize((mcb), (mcb)->m_size) | #define nxtMCB(mcb) nxtMCBsize((mcb), (mcb)->m_size) | ||||||
| 
 | 
 | ||||||
| #define mcbFree(mcb) ((mcb)->m_psp == FREE_PSP) | #define mcbFree(mcb) ((mcb)->m_psp == FREE_PSP) | ||||||
| #define mcbValid(mcb)			\ | #define mcbValid(mcb)  ( ((mcb)->m_size != 0xffff) && \ | ||||||
| 	((mcb)->m_type == MCB_NORMAL || (mcb)->m_type == MCB_LAST) |         ((mcb)->m_type == MCB_NORMAL || (mcb)->m_type == MCB_LAST) ) | ||||||
|  | #define mcbFreeable(mcb)                       \ | ||||||
|  |         ((mcb)->m_type == MCB_NORMAL || (mcb)->m_type == MCB_LAST) | ||||||
| 
 | 
 | ||||||
| #define para2far(seg) (mcb FAR *)MK_FP((seg) , 0) | #define para2far(seg) (mcb FAR *)MK_FP((seg) , 0) | ||||||
| 
 | 
 | ||||||
| @ -67,6 +69,11 @@ STATIC COUNT joinMCBs(seg para) | |||||||
|     p->m_type = q->m_type;      /* possibly the next MCB is the last one */ |     p->m_type = q->m_type;      /* possibly the next MCB is the last one */ | ||||||
|     p->m_size += q->m_size + 1; /* one for q's MCB itself */ |     p->m_size += q->m_size + 1; /* one for q's MCB itself */ | ||||||
|     q->m_type = 'K';            /* Invalidate the magic number */ |     q->m_type = 'K';            /* Invalidate the magic number */ | ||||||
|  | #if 0                          /* this spoils QB4's habit to double-free: */
 | ||||||
|  |     q->m_type = 'K';            /* Invalidate the magic number (whole MCB) */ | ||||||
|  | #else | ||||||
|  |     q->m_size = 0xffff;                /* mark the now unlinked MCB as "fake" */ | ||||||
|  | #endif | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   return SUCCESS; |   return SUCCESS; | ||||||
| @ -289,7 +296,7 @@ COUNT DosMemFree(UWORD para) | |||||||
|   p = para2far(para); |   p = para2far(para); | ||||||
| 
 | 
 | ||||||
|   /* check for corruption                         */ |   /* check for corruption                         */ | ||||||
|   if (!mcbValid(p)) |   if (!mcbFreeable(p)) /* does not have to be valid, freeable is enough */ | ||||||
|     return DE_INVLDMCB; |     return DE_INVLDMCB; | ||||||
| 
 | 
 | ||||||
|   /* Mark the mcb as free so that we can later    */ |   /* Mark the mcb as free so that we can later    */ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user