So I finally tracked down the real cause. It wasn't pointers or texture ID numbers. It was the fact that the .wal loading code was storing texture names with the ".wal" extension, where everything else expected the extension to be stripped. This should be fixed for the next version.