canonicalize: reduce memory usage
authorEric Blake <ebb9@byu.net>
Sat, 19 Dec 2009 16:28:36 +0000 (09:28 -0700)
committerEric Blake <ebb9@byu.net>
Sat, 19 Dec 2009 18:53:38 +0000 (11:53 -0700)
commitf65232a174c15c6c10273185f11b190cae5736ad
tree641dccc428b395113d30082b9bb2a119d75cf86a
parentdcfa509347541cf4a44f7e5be5fc74398d8a8199
canonicalize: reduce memory usage

canonicalize was returning a 4k buffer for everything, even though
the majority of canonical path names are much shorter.  This
resulted in a lot of unused memory, which in turn made tar run
out of memory when tracking a lot of files:
http://lists.gnu.org/archive/html/bug-tar/2009-12/msg00011.html

* lib/canonicalize.c (canonicalize_filename_mode): Trim the
allocation to size.
Reported by Solar Designer <solar@openwall.com>.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/canonicalize.c