]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Issue 578: Close temp_fd in 7zip and xar writers 607/head
authorPaul Barker <paul@paulbarker.me.uk>
Sat, 26 Sep 2015 18:38:13 +0000 (19:38 +0100)
committerPaul Barker <paul@paulbarker.me.uk>
Sat, 26 Sep 2015 18:41:10 +0000 (19:41 +0100)
The ISO9660 writer uses a temp_fd and closes it in the archive_free handler. The
same logic is added to the archive_free handlers for the 7zip and xar writers.

Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
libarchive/archive_write_set_format_7zip.c
libarchive/archive_write_set_format_xar.c

index 7847cb3c5994f15cc8edc0610d93b64376787c74..fc6ccfe0ba838ffeaa3431f5eb59724335fcc2be 100644 (file)
@@ -1450,6 +1450,10 @@ _7z_free(struct archive_write *a)
 {
        struct _7zip *zip = (struct _7zip *)a->format_data;
 
+       /* Close the temporary file. */
+       if (zip->temp_fd >= 0)
+               close(zip->temp_fd);
+
        file_free_register(zip);
        compression_end(&(a->archive), &(zip->stream));
        free(zip->coder.props);
index 4538befd9ebc91ce19ace1afb5cec9d3701d628b..a2dbc03991df9185f5599f044a6969c9964ce6f2 100644 (file)
@@ -1877,6 +1877,11 @@ xar_free(struct archive_write *a)
        struct xar *xar;
 
        xar = (struct xar *)a->format_data;
+
+       /* Close the temporary file. */
+       if (xar->temp_fd >= 0)
+               close(xar->temp_fd);
+
        archive_string_free(&(xar->cur_dirstr));
        archive_string_free(&(xar->tstr));
        archive_string_free(&(xar->vstr));