diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-07-22 22:49:49 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-07-22 22:49:49 +0000 |
commit | 701fce8e5cf875e42491207e6861da795908fbf5 (patch) | |
tree | cb63992e4a753814d62a68d11b0ba2a5e1d1200c /src/common/torgzip.c | |
parent | 0104882e9b320a6b9b5d02fdd8b638d90fff1a1c (diff) | |
download | tor-701fce8e5cf875e42491207e6861da795908fbf5.tar.gz tor-701fce8e5cf875e42491207e6861da795908fbf5.zip |
r13858@catbus: nickm | 2007-07-22 18:44:02 -0400
Fix/note some relatively trivial mem usage issues
svn:r10905
Diffstat (limited to 'src/common/torgzip.c')
-rw-r--r-- | src/common/torgzip.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/torgzip.c b/src/common/torgzip.c index 5a1e1e8a0b..f1771c183c 100644 --- a/src/common/torgzip.c +++ b/src/common/torgzip.c @@ -136,6 +136,10 @@ tor_gzip_compress(char **out, size_t *out_len, } done: *out_len = stream->total_out; + if (stream->total_out > out_size + 4097) { + /* If we're wasting more than 4k, don't. */ + tor_realloc(*out, stream->total_out + 1); + } if (deflateEnd(stream)!=Z_OK) { log_warn(LD_BUG, "Error freeing gzip structures"); goto err; |