diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-09-08 22:00:29 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-09-08 22:00:29 +0000 |
commit | bd911d8612f11c926d19ecaa68f405f22cfef348 (patch) | |
tree | c6878dffd4fd950bad025104cd9d5cc2313babfd /src/or/directory.c | |
parent | 659491bbc6105236ec6bc477b3e30a478e5ebe36 (diff) | |
download | tor-bd911d8612f11c926d19ecaa68f405f22cfef348.tar.gz tor-bd911d8612f11c926d19ecaa68f405f22cfef348.zip |
Fix segfault and memleak when getting many compressed server descs.
svn:r4956
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 0f93f3a53f..08a07bd33e 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -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, |