[1.0.6-git] physfs_rwops memory leak
Posted: Thu Nov 28, 2013 1:15 pm
PhysFS's PHYSFS_close() function was changed to have the same error code style as fclose and many other standard C functions (return an error code, zero indicates no error). However, src/physfs/physfsrwops.c was never updated to reflect this change. The result? Every file opened by T-Engine never gets closed / garbage collected correctly.
Relevant commit: abe424d
Simple fix:
Relevant commit: abe424d
Simple fix:
Code: Select all
diff --git a/src/physfs/physfsrwops.c b/src/physfs/physfsrwops.c
index a661c1a..a5a0bbd 100644
--- a/src/physfs/physfsrwops.c
+++ b/src/physfs/physfsrwops.c
@@ -126,7 +126,8 @@ static size_t physfsrwops_write(SDL_RWops *rw, const void *ptr, size_t size, siz
static int physfsrwops_close(SDL_RWops *rw)
{
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
- if (!PHYSFS_close(handle))
+ /* Note: PHYSFS_close was modified to return zero on success */
+ if (PHYSFS_close(handle))
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
return(-1);