summaryrefslogtreecommitdiffstats
path: root/compress.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-03-22 02:17:52 +0100
committerBen Lindstrom <mouring@eviladmin.org>2002-03-22 02:17:52 +0100
commitce398b2278d345707ad20b76cf2ec770188eecce (patch)
treed994b4c75997e1a176d87ae37c81212f60876fb3 /compress.c
parent - itojun@cvs.openbsd.org 2002/03/15 11:00:38 (diff)
downloadopenssh-ce398b2278d345707ad20b76cf2ec770188eecce.tar.xz
openssh-ce398b2278d345707ad20b76cf2ec770188eecce.zip
- markus@cvs.openbsd.org 2002/03/16 11:24:53
[compress.c] skip inflateEnd if inflate fails; ok provos@
Diffstat (limited to 'compress.c')
-rw-r--r--compress.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/compress.c b/compress.c
index 3badbf452..e2efa6846 100644
--- a/compress.c
+++ b/compress.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: compress.c,v 1.17 2001/12/29 21:56:01 stevesk Exp $");
+RCSID("$OpenBSD: compress.c,v 1.18 2002/03/16 11:24:53 markus Exp $");
#include "log.h"
#include "buffer.h"
@@ -23,6 +23,8 @@ static z_stream incoming_stream;
static z_stream outgoing_stream;
static int compress_init_send_called = 0;
static int compress_init_recv_called = 0;
+static int inflate_failed = 0;
+static int deflate_failed = 0;
/*
* Initializes compression; level is compression level from 1 to 9
@@ -62,9 +64,9 @@ buffer_compress_uninit(void)
incoming_stream.total_out, incoming_stream.total_in,
incoming_stream.total_out == 0 ? 0.0 :
(double) incoming_stream.total_in / incoming_stream.total_out);
- if (compress_init_recv_called == 1)
+ if (compress_init_recv_called == 1 && inflate_failed == 0)
inflateEnd(&incoming_stream);
- if (compress_init_send_called == 1)
+ if (compress_init_send_called == 1 && deflate_failed == 0)
deflateEnd(&outgoing_stream);
}
@@ -106,6 +108,7 @@ buffer_compress(Buffer * input_buffer, Buffer * output_buffer)
sizeof(buf) - outgoing_stream.avail_out);
break;
default:
+ deflate_failed = 1;
fatal("buffer_compress: deflate returned %d", status);
/* NOTREACHED */
}
@@ -149,6 +152,7 @@ buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer)
*/
return;
default:
+ inflate_failed = 1;
fatal("buffer_uncompress: inflate returned %d", status);
/* NOTREACHED */
}