VirtuaAllocCopyEx crashing after the first time

I am working on a graphics driver on WINCE 6.0. I am having the following

I boot up my target and run the driver and a demo. The demo runs fine. I
close the demo and it exits "fine." When I try to run the demo again (any
demo so it's not particular to this one graphics demo) the driver crashes at
a particular place where
it's mapping a buffer using VirtuaAllocCopyEx .

I have traced this behaviour and during the first run (when everything runs
and exits "normally" or so it seems) the buffer is mapped fine, and then when
the demo exits the same buffer is unmapped with VirtualFree.

When I run the demo the second time and it's time to map the buffer again
with VirtuaAllocCopyEx, the driver crashes inside physmem.c in DupPhysPage().

Any ideas what might make VirtuaAllocCopyEx crash like that?

If I need to provide more information please let me know.