Line 226: ppdev->PointerColorSurface is deleted but the next line sets
PointerMaskSurface to NULL instead of PointerColorSurface which leads to Line: 230 being FALSE and memory not being released.
Also on line 299: ppdev->PointerMaskSurface = NULL;
It can't be reached if psoMask == NULL on Line 252 because of the return statement. So line 299 will never ne executed.