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

[tor-commits] [tor/maint-0.3.4] Fix potential memory leak in test_hs_auth_cookies().



commit 1724f995c71502977c79343922ab50fc2403284f
Author: Alexander Færøy <ahf@xxxxxxxxxxxxxx>
Date:   Sat Jun 23 03:17:09 2018 +0200

    Fix potential memory leak in test_hs_auth_cookies().
    
    This patch fixes a potential memory leak in test_hs_auth_cookies() if a
    test-case fails and we goto the done label where no memory clean up is
    done.
    
    See: Coverity CID 1437453
---
 src/test/test_hs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index 8237bbc50..d572dd8d2 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -446,10 +446,10 @@ test_hs_auth_cookies(void *arg)
 #define TEST_COOKIE_ENCODED_STEALTH "YWJjZGVmZ2hpamtsbW5vcB"
 #define TEST_COOKIE_ENCODED_INVALID "YWJjZGVmZ2hpamtsbW5vcD"
 
-  char *encoded_cookie;
+  char *encoded_cookie = NULL;
   uint8_t raw_cookie[REND_DESC_COOKIE_LEN];
   rend_auth_type_t auth_type;
-  char *err_msg;
+  char *err_msg = NULL;
   int re;
 
   (void)arg;
@@ -495,6 +495,9 @@ test_hs_auth_cookies(void *arg)
   tor_free(err_msg);
 
  done:
+  tor_free(encoded_cookie);
+  tor_free(err_msg);
+
   return;
 }
 



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