diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-07-13 05:26:43 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-07-13 05:26:43 +0000 |
commit | 50e11ee16ad19a4ec880d5fa34e488ca0d8f993b (patch) | |
tree | f96427d0aadf9d1bb3fe046dabc9140065956374 /src/common/torgzip.c | |
parent | cf13b3e4a65cef83190410095255bcc071949ef2 (diff) | |
download | tor-50e11ee16ad19a4ec880d5fa34e488ca0d8f993b.tar.gz tor-50e11ee16ad19a4ec880d5fa34e488ca0d8f993b.zip |
Fix possible double call to inflateEnd.
svn:r4540
Diffstat (limited to 'src/common/torgzip.c')
-rw-r--r-- | src/common/torgzip.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/common/torgzip.c b/src/common/torgzip.c index 453ce6d8f3..f502c828b8 100644 --- a/src/common/torgzip.c +++ b/src/common/torgzip.c @@ -147,6 +147,7 @@ tor_gzip_uncompress(char **out, size_t *out_len, struct z_stream_s *stream = NULL; size_t out_size; off_t offset; + int r; tor_assert(out); tor_assert(out_len); @@ -202,15 +203,15 @@ tor_gzip_uncompress(char **out, size_t *out_len, stream->msg ? stream->msg : "<no message>"); goto err; } - } done: *out_len = stream->total_out; - if (inflateEnd(stream)!=Z_OK) { + r = inflateEnd(stream); + tor_free(stream); + if (r != Z_OK) { log_fn(LOG_WARN, "Error freeing gzip structures"); - goto err; /* XXX this will try to inflateEnd again, right? is that bad? */ + goto err; } - tor_free(stream); /* NUL-terminate output. */ if (out_size == *out_len) |