summaryrefslogtreecommitdiffstats
path: root/Utilities/cmtar/decode.c
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2006-02-03 16:48:44 (GMT)
committerDavid Cole <david.cole@kitware.com>2006-02-03 16:48:44 (GMT)
commit0323a0d6d20402d994f4f886d51b8c33c02ed73a (patch)
tree9ac42eed35f442353e0068fbe898120444f853a5 /Utilities/cmtar/decode.c
parentafa83678854b7af547c9f0033ac5f7446a163447 (diff)
downloadCMake-0323a0d6d20402d994f4f886d51b8c33c02ed73a.zip
CMake-0323a0d6d20402d994f4f886d51b8c33c02ed73a.tar.gz
CMake-0323a0d6d20402d994f4f886d51b8c33c02ed73a.tar.bz2
BUG: Fix mem leaks related to th_get_pathname. Change this implementation of th_get_pathname so that it *always* returns a strdup'ed value. Callers must now free non-NULL returns from th_get_pathname. Change all callers to call free appropriately.
Diffstat (limited to 'Utilities/cmtar/decode.c')
-rw-r--r--Utilities/cmtar/decode.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Utilities/cmtar/decode.c b/Utilities/cmtar/decode.c
index 788fb3f..d6a48c5 100644
--- a/Utilities/cmtar/decode.c
+++ b/Utilities/cmtar/decode.c
@@ -31,13 +31,15 @@
/* determine full path name */
+/* caller must "free" returned pointer when done with it */
+/* th_get_pathname return values come directly from strdup */
char *
th_get_pathname(TAR *t)
{
char filename[TAR_MAXPATHLEN];
if (t->th_buf.gnu_longname)
- return t->th_buf.gnu_longname;
+ return strdup(t->th_buf.gnu_longname);
if (t->th_buf.prefix[0] != '\0')
{