Skip to content
Permalink
Browse files
Try to shrink returned buffer's allocation.
  • Loading branch information
icculus committed Jul 8, 2009
1 parent ff80fc8 commit 43207273dd73231ff75e8712726e736630ebd929
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/platform_unix.c
@@ -261,6 +261,14 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
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 */

0 comments on commit 4320727

Please sign in to comment.