- markus@cvs.openbsd.org 2002/03/16 11:24:53
[compress.c] skip inflateEnd if inflate fails; ok provos@
This commit is contained in:
parent
b61e6df9f3
commit
ce398b2278
|
@ -21,6 +21,9 @@
|
|||
- itojun@cvs.openbsd.org 2002/03/15 11:00:38
|
||||
[auth.c]
|
||||
fix file type checking (use S_ISREG). ok by markus
|
||||
- markus@cvs.openbsd.org 2002/03/16 11:24:53
|
||||
[compress.c]
|
||||
skip inflateEnd if inflate fails; ok provos@
|
||||
|
||||
20020317
|
||||
- (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted,
|
||||
|
@ -7867,4 +7870,4 @@
|
|||
- Wrote replacements for strlcpy and mkdtemp
|
||||
- Released 1.0pre1
|
||||
|
||||
$Id: ChangeLog,v 1.1930 2002/03/22 01:15:33 mouring Exp $
|
||||
$Id: ChangeLog,v 1.1931 2002/03/22 01:17:52 mouring Exp $
|
||||
|
|
10
compress.c
10
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 */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue