summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/compress.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/ssh/compress.c')
-rw-r--r--usr.bin/ssh/compress.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/ssh/compress.c b/usr.bin/ssh/compress.c
index 3badbf452da..e2efa6846f0 100644
--- a/usr.bin/ssh/compress.c
+++ b/usr.bin/ssh/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 */
}