mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Fix segfault and memleak when getting many compressed server descs.
svn:r4956
This commit is contained in:
parent
659491bbc6
commit
bd911d8612
@ -1222,16 +1222,17 @@ directory_handle_command_get(connection_t *conn, char *headers,
|
||||
/* XXXX NM This could be way more efficiently handled. */
|
||||
if (tor_gzip_compress(&compressed, &compressed_len,
|
||||
inp, cp-inp, ZLIB_METHOD)<0) {
|
||||
tor_free(cp);
|
||||
tor_free(inp);
|
||||
smartlist_free(descs);
|
||||
return -1;
|
||||
}
|
||||
tor_free(cp);
|
||||
tor_free(inp);
|
||||
tor_snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: application/octet-stream\r\n\r\n",
|
||||
date,
|
||||
(int)compressed_len);
|
||||
connection_write_to_buf(tmp, strlen(tmp), conn);
|
||||
connection_write_to_buf(compressed, compressed_len, conn);
|
||||
tor_free(compressed);
|
||||
} else {
|
||||
tor_snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: application/octet-stream\r\n\r\n",
|
||||
date,
|
||||
|
Loading…
Reference in New Issue
Block a user