Merge pull request #3124 from stoeckmann/entry_mem
entry_link_resolver: Improve memory handling
(cherry picked from commit 5335a4ed97)
This commit is contained in:
1 parent
276c750ae5
commit
5eb060231f
1 file changed
+5
-1
@@ -78,7 +78,7 @@ struct links_entry {
|
||||
struct archive_entry_linkresolver {
|
||||
struct links_entry **buckets;
|
||||
struct links_entry *spare;
|
||||
unsigned long number_entries;
|
||||
size_t number_entries;
|
||||
size_t number_buckets;
|
||||
int strategy;
|
||||
};
|
||||
@@ -381,6 +381,10 @@ insert_entry(struct archive_entry_linkresolver *res,
|
||||
if (le == NULL)
|
||||
return (NULL);
|
||||
le->canonical = archive_entry_clone(entry);
|
||||
if (le->canonical == NULL) {
|
||||
free(le);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* If the links cache is getting too full, enlarge the hash table. */
|
||||
if (res->number_entries > res->number_buckets * 2)
|
||||
|
||||
Reference in new issue
Block a user