diff options
author | cperciva <cperciva@FreeBSD.org> | 2008-05-23 05:07:22 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2008-05-23 05:07:22 +0000 |
commit | d6da92763e434b5a352932bf992e8eda0f1de268 (patch) | |
tree | d9a63f0480a7559c31ca66c84d0298d308ddf887 /usr.bin | |
parent | 8ae6743fcd2d34f030e006f8b78ec059408646b1 (diff) | |
download | FreeBSD-src-d6da92763e434b5a352932bf992e8eda0f1de268.zip FreeBSD-src-d6da92763e434b5a352932bf992e8eda0f1de268.tar.gz |
The value le->name cannot be NULL when we're freeing an entry in the
hardlink table for two reasons: 1. If le->name is set to NULL, the
structure le won't be inserted into the table; 2. Even if le somehow
did manage to get into the table with le->name equal to NULL, we would
die when we dereferenced le->null before we could get to the point of
freeing the entry.
Remove the unnecessary "if (le->name != NULL)" test and just free the
pointer.
Found by: Coverity Prevent
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tar/write.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c index 8fe0530..9b3f39b 100644 --- a/usr.bin/tar/write.c +++ b/usr.bin/tar/write.c @@ -1100,8 +1100,7 @@ lookup_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); + free(le->name); if (links_cache->buckets[hash] == le) links_cache->buckets[hash] = le->next; links_cache->number_entries--; |