SDL_image Rwops not working properly in Windows

I’m using SDL_image 1.2.3 and SDL 1.2.7 on Windows, with PHYSFS and the
glue code for Rwops from a PHYSFS file. My problem is that my game
works in Linux without problems, but eventually crashes in Windows. I
have traced this to when I try to load said image from IMG_Load_RW,
after getting the RWops. This is my Load Image function:

SDL_Surface *LoadIMG(std::string imgfile)
PHYSFS_file *temp=PHYSFS_openRead(imgfile.c_str());
if (!temp)
std::string temp2="Could not open file ";
FPK_Invalid(“Unknown FPK!”, temp2);
SDL_RWops *rw=create_rwops(temp);
SDL_Surface *tempsurf=IMG_Load_RW(rw,0);

SDL_Surface *surface=SDL_DisplayFormatAlpha(tempsurf);
return surface;


I can load the images just fine for a while, but there appears to be a
memory leak I cannot track down using either Boundschecker or valgrind.
Can anyone help? This happens to me in both Dev-cpp and VC6.