aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tar
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2004-04-13 23:50:48 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2004-04-13 23:50:48 +0000
commitc7141791f3afb2bb0b5bb811653ccee1423aea5f (patch)
treed1c0f4a3c7083c0c15708d7f85889f9046face52 /usr.bin/tar
parent907d74bb26b00c3857d7ec2755d80c39b90455e4 (diff)
downloadsrc-c7141791f3afb2bb0b5bb811653ccee1423aea5f.tar.gz
src-c7141791f3afb2bb0b5bb811653ccee1423aea5f.zip
When all the links to a file have been dumped, don't forget
to free() the memory used to store the filename.
Notes
Notes: svn path=/head/; revision=128206
Diffstat (limited to 'usr.bin/tar')
-rw-r--r--usr.bin/tar/write.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c
index d2eed4bf4d23..62a3d2eda4c9 100644
--- a/usr.bin/tar/write.c
+++ b/usr.bin/tar/write.c
@@ -807,7 +807,7 @@ record_hardlink(struct bsdtar *bsdtar, struct archive_entry *entry,
*/
for (le = bsdtar->links_head; le != NULL; le = le->next) {
if (le->dev == st->st_dev && le->ino == st->st_ino) {
- archive_entry_set_hardlink(entry, le->name);
+ archive_entry_copy_hardlink(entry, le->name);
/*
* Decrement link count each time and release
@@ -820,6 +820,8 @@ record_hardlink(struct bsdtar *bsdtar, struct archive_entry *entry,
le->previous->next = le->next;
if (le->next != NULL)
le->next->previous = le->previous;
+ if (le->name != NULL)
+ free(le->name);
if (bsdtar->links_head == le)
bsdtar->links_head = le->next;
free(le);