]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
r13858@catbus: nickm | 2007-07-22 18:44:02 -0400
authorNick Mathewson <nickm@torproject.org>
Sun, 22 Jul 2007 22:49:49 +0000 (22:49 +0000)
committerNick Mathewson <nickm@torproject.org>
Sun, 22 Jul 2007 22:49:49 +0000 (22:49 +0000)
 Fix/note some relatively trivial mem usage issues

svn:r10905

src/common/torgzip.c
src/or/circuitbuild.c
src/or/main.c

index 5a1e1e8a0b677543e03a984dc6d5955ca8b8883c..f1771c183c28438506e9486cf32ecc695f222c26 100644 (file)
@@ -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;
index 5cf90bd5857ffa0566a0ae02de4463fd1433ba6d..8f2e4ed74726cd218ac695e1275b235e7a891a6d 100644 (file)
@@ -1072,7 +1072,8 @@ circuit_get_unhandled_ports(time_t now)
   int i;
 
   for (i = 0; i < smartlist_len(source); ++i) {
-    tmp = tor_malloc(sizeof(uint16_t));
+    /*XXXX020 some of these are leaked somewhere.. fix that. */
+    tmp = tor_malloc(sizeof(uint16_t)); 
     memcpy(tmp, smartlist_get(source, i), sizeof(uint16_t));
     smartlist_add(dest, tmp);
   }
index a41b8cb17f8d79d7098c4394e87fafe825c17373..085d3044e05aa687be2934667c63fabba213f18e 100644 (file)
@@ -1763,6 +1763,7 @@ tor_free_all(int postfork)
   routerlist_free_all();
   addressmap_free_all();
   set_exit_redirects(NULL); /* free the registered exit redirects */
+  esc_router_info(NULL); /* free a static field */
   dirserv_free_all();
   rend_service_free_all();
   rend_cache_free_all();