mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-23 22:47:12 +01:00
Remove a ridiculous realloc call from torgzip.c
realloc()ing a thing in order to try to save memory on it just doesn't make sense with today's allocators. Instead, let's use the fact that whenever we decompress something, either it isn't too big, or we chop it up, or we reallocate it.
This commit is contained in:
parent
808015316a
commit
358fc026d9
1 changed files with 0 additions and 4 deletions
|
@ -213,10 +213,6 @@ tor_gzip_compress(char **out, size_t *out_len,
|
|||
* the newly unsigned field isn't negative." */
|
||||
tor_assert(stream->total_out >= 0);
|
||||
#endif
|
||||
if (((size_t)stream->total_out) > out_size + 4097) {
|
||||
/* If we're wasting more than 4k, don't. */
|
||||
*out = tor_realloc(*out, stream->total_out + 1);
|
||||
}
|
||||
if (deflateEnd(stream)!=Z_OK) {
|
||||
log_warn(LD_BUG, "Error freeing gzip structures");
|
||||
goto err;
|
||||
|
|
Loading…
Add table
Reference in a new issue