]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Hard-wire buffer size only once and check for malloc error.
authorJoerg Sonnenberger <joerg.sonnenberger@gmail.com>
Tue, 26 May 2009 20:01:19 +0000 (16:01 -0400)
committerJoerg Sonnenberger <joerg.sonnenberger@gmail.com>
Tue, 26 May 2009 20:01:19 +0000 (16:01 -0400)
SVN-Revision: 1134

libarchive/archive_write_set_format_zip.c

index e7ea1b25d87e78a1427ffd2f0f72481c4f15180f..61fffc47ba529222a4d3d8dd6054da53d9b69875 100644 (file)
@@ -220,8 +220,12 @@ archive_write_set_format_zip(struct archive *_a)
 
 #ifdef HAVE_ZLIB_H
        zip->compression = COMPRESSION_DEFLATE;
-       zip->len_buf = 64 * 1024;
-       zip->buf = malloc(64 * 1024);
+       zip->len_buf = 65536;
+       zip->buf = malloc(zip->len_buf);
+       if (zip->buf == NULL) {
+               archive_set_error(&a->archive, ENOMEM, "Can't allocate compression buffer");
+               return (ARCHIVE_FATAL);
+       }
 #else
        zip->compression = COMPRESSION_STORE;
 #endif