Try to shrink returned buffer's allocation.
This commit is contained in:
parent
ff80fc8003
commit
43207273dd
|
@ -261,6 +261,14 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
|
||||||
allocator.Free(envr);
|
allocator.Free(envr);
|
||||||
} /* if */
|
} /* 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);
|
return(retval);
|
||||||
} /* __PHYSFS_platformCalcBaseDir */
|
} /* __PHYSFS_platformCalcBaseDir */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue