From: Joerg Sonnenberger Date: Tue, 26 May 2009 20:01:19 +0000 (-0400) Subject: Hard-wire buffer size only once and check for malloc error. X-Git-Tag: v2.8.0~610 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b48b3609b74695425311c22cebbda00c80da5409;p=thirdparty%2Flibarchive.git Hard-wire buffer size only once and check for malloc error. SVN-Revision: 1134 --- diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index e7ea1b25d..61fffc47b 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -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