# HG changeset patch # User Ryan C. Gordon # Date 1247089625 14400 # Node ID 001380a457a04ce565c5572dd95d80fa772ffb01 # Parent b0c6f2f4f361fef6a60a22198007afff4b418d64 Try to shrink returned buffer's allocation. diff -r b0c6f2f4f361 -r 001380a457a0 src/platform_unix.c --- a/src/platform_unix.c Wed Jul 08 17:46:48 2009 -0400 +++ b/src/platform_unix.c Wed Jul 08 17:47:05 2009 -0400 @@ -261,6 +261,14 @@ allocator.Free(envr); } /* if */ + if (retval != NULL) + { + /* try to shrink buffer... */ + char *ptr = (char *) allocator.Realloc(retval, strlen(retval) + 1); + if (ptr != NULL) + retval = ptr; /* oh well if it failed. */ + } /* if */ + return(retval); } /* __PHYSFS_platformCalcBaseDir */