summaryrefslogtreecommitdiff
path: root/libarchive/archive.h
diff options
context:
space:
mode:
authorMartin Matuska <martin@matuska.org>2020-11-06 03:17:11 +0100
committerMartin Matuska <martin@matuska.org>2020-11-08 12:01:44 +0100
commit1963f1096a40307d6c27a2fe82d37cca1b920774 (patch)
treeeb3b18de50a6a3999baae8051c06bcb24e75b705 /libarchive/archive.h
parentf6154ee30278a98279891aa6e5705196337469b2 (diff)
downloadlibarchive-1963f1096a40307d6c27a2fe82d37cca1b920774.tar.gz
Introduce archive_write_open2() with free callback
The archive_write_open() function does not provide a free callback. Freeing was done by the close callback. When the open callback fails, the client filter is left in ARCHIVE_WRITE_FILTER_STATE_FATAL, the close callback is not called and unfreed resources may be left behind. Fixes #1456
Diffstat (limited to 'libarchive/archive.h')
-rw-r--r--libarchive/archive.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libarchive/archive.h b/libarchive/archive.h
index a3f3bfd7..34d098fd 100644
--- a/libarchive/archive.h
+++ b/libarchive/archive.h
@@ -246,6 +246,8 @@ typedef int archive_open_callback(struct archive *, void *_client_data);
typedef int archive_close_callback(struct archive *, void *_client_data);
+typedef int archive_free_callback(struct archive *, void *_client_data);
+
/* Switches from one client data object to the next/prev client data object.
* This is useful for reading from different data blocks such as a set of files
* that make up one large file.
@@ -818,9 +820,13 @@ __LA_DECL int archive_write_set_format_filter_by_ext(struct archive *a, const ch
__LA_DECL int archive_write_set_format_filter_by_ext_def(struct archive *a, const char *filename, const char * def_ext);
__LA_DECL int archive_write_zip_set_compression_deflate(struct archive *);
__LA_DECL int archive_write_zip_set_compression_store(struct archive *);
+/* Deprecated; use archive_write_open2 instead */
__LA_DECL int archive_write_open(struct archive *, void *,
archive_open_callback *, archive_write_callback *,
archive_close_callback *);
+__LA_DECL int archive_write_open2(struct archive *, void *,
+ archive_open_callback *, archive_write_callback *,
+ archive_close_callback *, archive_free_callback *);
__LA_DECL int archive_write_open_fd(struct archive *, int _fd);
__LA_DECL int archive_write_open_filename(struct archive *, const char *_file);
__LA_DECL int archive_write_open_filename_w(struct archive *,