Noted a bug with a possible patch below based on the fact that the error refers to "SDL surface memory", so the intent of the line must have been to check for a swsurface. The alternative is that the line was meant to disable that block of code, but I would think if(0) would have been used. Thank you for any help.
On further study of the code, I think now that I was wrong and that there is no bug. The check must be for either swsurface or hwsurface, and the current code does this check (and other checks in dx5video) as expected.