[Spice-devel] [PATCH 5/8] display/res: better error message for FreeMem assert
Alon Levy
alevy at redhat.com
Mon Jun 20 03:50:53 PDT 2011
---
display/res.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/display/res.c b/display/res.c
index 1b8cf84..dd57491 100644
--- a/display/res.c
+++ b/display/res.c
@@ -344,8 +344,13 @@ static void *__AllocMem(PDev* pdev, UINT32 mspace_type, size_t size, BOOL force)
static void FreeMem(PDev* pdev, UINT32 mspace_type, void *ptr)
{
ASSERT(pdev, pdev && pdev->Res->mspaces[mspace_type]._mspace);
- ASSERT(pdev, (UINT8 *)ptr >= pdev->Res->mspaces[mspace_type].mspace_start &&
- (UINT8 *)ptr < pdev->Res->mspaces[mspace_type].mspace_end);
+ if (!((UINT8 *)ptr >= pdev->Res->mspaces[mspace_type].mspace_start &&
+ (UINT8 *)ptr < pdev->Res->mspaces[mspace_type].mspace_end)) {
+ DebugPrint(pdev, 0, "ASSERT failed @ %s, %p not in [%p, %p) (%d)\n", __FUNCTION__,
+ ptr, pdev->Res->mspaces[mspace_type].mspace_start,
+ pdev->Res->mspaces[mspace_type].mspace_end, mspace_type);
+ EngDebugBreak();
+ }
EngAcquireSemaphore(pdev->Res->malloc_sem);
mspace_free(pdev->Res->mspaces[mspace_type]._mspace, ptr);
EngReleaseSemaphore(pdev->Res->malloc_sem);
--
1.7.5.2
More information about the Spice-devel
mailing list