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
This commit is contained in:
parent
b011a14a0a
commit
29d10c76f9
@ -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--;
|
||||
|
Loading…
x
Reference in New Issue
Block a user