[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Fix a harmless memory leak in tor-gencert



commit 72c4a4eb03d6d1be1de2701b4c2c2703bfbca699
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue May 5 11:05:01 2015 -0400

    Fix a harmless memory leak in tor-gencert
---
 src/tools/tor-gencert.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tools/tor-gencert.c b/src/tools/tor-gencert.c
index c0cab7e..28b1a58 100644
--- a/src/tools/tor-gencert.c
+++ b/src/tools/tor-gencert.c
@@ -186,8 +186,7 @@ parse_commandline(int argc, char **argv)
         return 1;
       in.s_addr = htonl(addr);
       tor_inet_ntoa(&in, b, sizeof(b));
-      address = tor_malloc(INET_NTOA_BUF_LEN+32);
-      tor_snprintf(address, INET_NTOA_BUF_LEN+32, "%s:%d", b, (int)port);
+      tor_asprintf(&address, "%s:%d", b, (int)port);
     } else if (!strcmp(argv[i], "--create-identity-key")) {
       make_new_id = 1;
     } else if (!strcmp(argv[i], "--passphrase-fd")) {
@@ -566,6 +565,7 @@ main(int argc, char **argv)
   tor_free(identity_key_file);
   tor_free(signing_key_file);
   tor_free(certificate_file);
+  tor_free(address);
 
   crypto_global_cleanup();
   return r;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits