fixed bug in bmFree function to make sure size being freed is PSZ aligned.
authorDavid Lide <a0216552@gtudci01.(none)>
Fri, 22 May 2015 13:44:55 +0000 (09:44 -0400)
committerDavid Lide <a0216552@gtudci01.(none)>
Fri, 22 May 2015 13:44:55 +0000 (09:44 -0400)
ti/runtime/hplib/src/bm_alloc.c

index a5decbb01c0be7c53eeca7bffa8ce7d7a2f2beee..0a7dd14131483794a3ebce7eb1c529f810b85cd0 100755 (executable)
@@ -209,7 +209,9 @@ void bmFree(void * blob, uint8_t *p, uint32_t size)
     unsigned int off = p-pCtx->pBase;
     int wpos, bpos;
     int ewpos, ebpos;
+    int szinpages = size/pCtx->PSZ;
     if (off > pCtx->maxsize) return;
+    if (szinpages*pCtx->PSZ != sz) sz = (szinpages+1)*pCtx->PSZ;
     wpos= bmToWordBit(pCtx,  off, &bpos);
     ewpos= bmToWordBit(pCtx, off+size, &ebpos);
     //adjust by 1