summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-libarchive.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2016-12-02 13:34:32 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2016-12-05 15:20:56 +0000
commit7bb0ff46a438977297329ad6949faa4fae06f543 (patch)
treef2e516baaca3d8db02c6d889375ed02153ec53c7 /src/libostree/ostree-repo-libarchive.c
parentc733e21a84f788cb4c9ac4e723743cedb898b345 (diff)
downloadostree-7bb0ff46a438977297329ad6949faa4fae06f543.tar.gz
Define and use cleanup helpers for libarchive
This should fix some of the ASAN leaks around libarchive usage, and is generally better. Closes: #609 Approved by: jlebon
Diffstat (limited to 'src/libostree/ostree-repo-libarchive.c')
-rw-r--r--src/libostree/ostree-repo-libarchive.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libostree/ostree-repo-libarchive.c b/src/libostree/ostree-repo-libarchive.c
index 02a1180a..01982894 100644
--- a/src/libostree/ostree-repo-libarchive.c
+++ b/src/libostree/ostree-repo-libarchive.c
@@ -913,10 +913,9 @@ ostree_repo_write_archive_to_mtree (OstreeRepo *self,
{
#ifdef HAVE_LIBARCHIVE
gboolean ret = FALSE;
- struct archive *a = NULL;
+ ot_cleanup_read_archive struct archive *a = archive_read_new ();
OstreeRepoImportArchiveOptions opts = { 0, };
- a = archive_read_new ();
#ifdef HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL
archive_read_support_filter_all (a);
#else
@@ -945,7 +944,6 @@ ostree_repo_write_archive_to_mtree (OstreeRepo *self,
if (a)
{
(void)archive_read_close (a);
- (void)archive_read_free (a);
}
return ret;
#else