diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-04-13 23:50:48 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-04-13 23:50:48 +0000 |
commit | 2d6a22a91ddcf2e70275c468b19b9ef2b8f58e70 (patch) | |
tree | d1c0f4a3c7083c0c15708d7f85889f9046face52 /usr.bin | |
parent | a67431b09b023ddeb687fb37f83939d28b34af5a (diff) | |
download | FreeBSD-src-2d6a22a91ddcf2e70275c468b19b9ef2b8f58e70.zip FreeBSD-src-2d6a22a91ddcf2e70275c468b19b9ef2b8f58e70.tar.gz |
When all the links to a file have been dumped, don't forget
to free() the memory used to store the filename.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tar/write.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c index d2eed4b..62a3d2e 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); |