From: Joerg Sonnenberger Date: Tue, 20 May 2008 03:24:19 +0000 (-0400) Subject: Consistently use copy_hardlink. X-Git-Tag: v2.6.0~222 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d0a9a9ff77dc11675d066719b42beaf4964783b6;p=thirdparty%2Flibarchive.git Consistently use copy_hardlink. Fix a double-free/use-after-free. SVN-Revision: 70 --- diff --git a/libarchive/archive_entry_link_resolver.c b/libarchive/archive_entry_link_resolver.c index 3ce1070c6..e0e1bb7e5 100644 --- a/libarchive/archive_entry_link_resolver.c +++ b/libarchive/archive_entry_link_resolver.c @@ -149,10 +149,8 @@ archive_entry_linkresolver_free(struct archive_entry_linkresolver *res) struct links_entry *le; if (res->buckets != NULL) { - while ((le = next_entry(res)) != NULL) { + while ((le = next_entry(res)) != NULL) archive_entry_free(le->entry); - archive_entry_free(le->canonical); - } free(res->buckets); res->buckets = NULL; } @@ -186,7 +184,7 @@ archive_entry_linkify(struct archive_entry_linkresolver *res, le = find_entry(res, *e); if (le != NULL) { archive_entry_set_size(*e, 0); - archive_entry_set_hardlink(*e, + archive_entry_copy_hardlink(*e, archive_entry_pathname(le->canonical)); } else insert_entry(res, *e); @@ -214,7 +212,7 @@ archive_entry_linkify(struct archive_entry_linkresolver *res, le->entry = t; /* Make the old entry into a hardlink. */ archive_entry_set_size(*e, 0); - archive_entry_set_hardlink(*e, + archive_entry_copy_hardlink(*e, archive_entry_pathname(le->canonical)); /* If we ran out of links, return the * final entry as well. */