[physfs] Two Linux problems

Ryan C. Gordon icculus at icculus.org
Wed Jul 8 17:59:35 EDT 2009


> Here's the patch for the /proc/self/exe issue. There's one thing I'm
> unsure about, in __PHYSFS_platformCurrentDir you free the original
> buffer if the pointer returned by realloc is NULL, but looking at
> realloc's man page it doesn't say what it does when out of memory, so
> I didn't handle it.

It returns NULL, leaving the original memory it wanted to resize 
untouched (which is why you should never do something like "ptr = 
realloc(ptr, size);" since you have a memory leak if realloc() returns 
NULL.)

I did my own patch for the readlink() problem and fixed a few other 
things...the latest in the default branch (and stable-2.0 branch) should 
fix the issues. Let me know if it doesn't.

--ryan.



More information about the physfs mailing list