From 22ae326d013cf03fe19248bf5ed1c079203e69e2 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 24 Feb 2011 11:52:30 +1100 Subject: [PATCH] Make it always clear that a failure to allocate a buffer has occurred on compression. --- stream.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/stream.c b/stream.c index 49806cb..94fe161 100644 --- a/stream.c +++ b/stream.c @@ -156,7 +156,7 @@ static int zpaq_compress_buf(struct compress_thread *cthread, long thread) in = fmemopen(cthread->s_buf, cthread->s_len, "r"); if (unlikely(!in)) { - print_maxverbose("Failed to fmemopen in zpaq_compress_buf\n"); + print_err("Failed to fmemopen in zpaq_compress_buf\n"); return -1; } out = open_memstream((char **)&c_buf, &dlen); @@ -200,7 +200,7 @@ static int bzip2_compress_buf(struct compress_thread *cthread) c_buf = malloc(dlen); if (!c_buf) { - print_maxverbose("Unable to allocate c_buf\n"); + print_err("Unable to allocate c_buf in bzip2_compress_buf\n"); return -1; } @@ -246,7 +246,7 @@ static int gzip_compress_buf(struct compress_thread *cthread) c_buf = malloc(dlen); if (!c_buf) { - print_maxverbose("Unable to allocate c_buf\n"); + print_err("Unable to allocate c_buf in gzip_compress_buf\n"); return -1; } @@ -300,8 +300,10 @@ static int lzma_compress_buf(struct compress_thread *cthread) retry: dlen = cthread->s_len; c_buf = malloc(dlen); - if (!c_buf) + if (!c_buf) { + print_err("Unable to allocate c_buf in lzma_compress_buf\n"); return -1; + } /* with LZMA SDK 4.63, we pass compression level and threads only * and receive properties in control->lzma_properties */ @@ -377,8 +379,10 @@ static int lzo_compress_buf(struct compress_thread *cthread) } c_buf = malloc(dlen); - if (!c_buf) + if (!c_buf) { + print_err("Unable to allocate c_buf in lzo_compress_buf"); goto out_free; + } return_var = lzo1x_1_compress(cthread->s_buf, in_len, c_buf, &dlen, wrkmem); ret = 0;