src/platform_unix.c
changeset 1002 001380a457a0
parent 1001 b0c6f2f4f361
child 1003 a28d30d275e2
--- 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 */