summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-01-07 17:10:07 +0100
committerJim Meyering <meyering@redhat.com>2008-01-07 17:10:07 +0100
commitb84880d980d85dc68a1d43fec3ea4f18fd3feeda (patch)
tree4929f6768baa813672b3ee71d2ef5825a2c6d193
parent2deb4bd589701dbfeeb2fcd6552d21b9f11e11b4 (diff)
downloadcoreutils-b84880d980d85dc68a1d43fec3ea4f18fd3feeda.tar.gz
coreutils-b84880d980d85dc68a1d43fec3ea4f18fd3feeda.tar.bz2
coreutils-b84880d980d85dc68a1d43fec3ea4f18fd3feeda.zip
cp (but not copy.c): plug a small leak.
* src/cp.c (do_copy) [--parents]: Free the attribute list.
-rw-r--r--ChangeLog3
-rw-r--r--src/cp.c10
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c03c0d159..0018fdcf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2008-01-07 Jim Meyering <meyering@redhat.com>
+ cp (but not copy.c): plug a small leak.
+ * src/cp.c (do_copy) [--parents]: Free the attribute list.
+
Make a racy test failure less likely to happen.
* tests/misc/tty-eof: Uncomment a debug "warn".
This change happens to make this test far less likely to fail.
diff --git a/src/cp.c b/src/cp.c
index be3701fc8..01d98cc64 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -683,6 +683,16 @@ do_copy (int n_files, char **file, const char *target_directory,
attr_list, x);
}
+ if (parents_option)
+ {
+ while (attr_list)
+ {
+ struct dir_attr *p = attr_list;
+ attr_list = attr_list->next;
+ free (p);
+ }
+ }
+
free (dst_name);
}
}