]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
fix memleak in dump_signed_directory_to_string
authorRoger Dingledine <arma@torproject.org>
Thu, 26 Jun 2003 23:38:21 +0000 (23:38 +0000)
committerRoger Dingledine <arma@torproject.org>
Thu, 26 Jun 2003 23:38:21 +0000 (23:38 +0000)
svn:r358

src/or/main.c

index 7f3f0410209a80037390e9a3600055e013c8b227..0ee26e4b9dff46e2bd907696a6cb61a401353389 100644 (file)
@@ -739,10 +739,12 @@ dump_signed_directory_to_string_impl(char *s, int maxlen, directory_t *dir,
     if(written < 0) { 
       log(LOG_ERR,"dump_signed_directory_to_string(): tried to exceed string length.");
       cp[maxlen-1] = 0; /* make sure it's null terminated */
+      free(dir->routers);
       return -1;
     }
     cp += written;
   }
+  free(dir->routers); /* not needed anymore */
 
   /* These multiple strlen calls are inefficient, but dwarfed by the RSA
      signature.