mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Fix possible double call to inflateEnd.
svn:r4540
This commit is contained in:
parent
cf13b3e4a6
commit
50e11ee16a
@ -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) {
|
||||
log_fn(LOG_WARN, "Error freeing gzip structures");
|
||||
goto err; /* XXX this will try to inflateEnd again, right? is that bad? */
|
||||
}
|
||||
r = inflateEnd(stream);
|
||||
tor_free(stream);
|
||||
if (r != Z_OK) {
|
||||
log_fn(LOG_WARN, "Error freeing gzip structures");
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* NUL-terminate output. */
|
||||
if (out_size == *out_len)
|
||||
|
Loading…
Reference in New Issue
Block a user