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

[tor-commits] [tor/release-0.3.4] Fix potential memory leak in hs_helper_build_intro_point().



commit 8c8941eb297a166aa7b1b915a543bf97b3a63039
Author: Alexander Færøy <ahf@xxxxxxxxxxxxxx>
Date:   Sat Jun 23 00:44:33 2018 +0200

    Fix potential memory leak in hs_helper_build_intro_point().
    
    This patch fixes a potential memory leak in
    hs_helper_build_intro_point() where a `goto done` is called before the
    `intro_point` variable have been assigned to the value of the `ip`
    variable.
    
    See: Coverity CID 1437460
    See: Coverity CID 1437456
---
 src/test/hs_test_helpers.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/test/hs_test_helpers.c b/src/test/hs_test_helpers.c
index 3f0d6a941..f7e054b1d 100644
--- a/src/test/hs_test_helpers.c
+++ b/src/test/hs_test_helpers.c
@@ -85,6 +85,9 @@ hs_helper_build_intro_point(const ed25519_keypair_t *signing_kp, time_t now,
 
   intro_point = ip;
  done:
+  if (intro_point == NULL)
+    tor_free(ip);
+
   return intro_point;
 }
 



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