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

[tor-commits] [tor/maint-0.3.3] Fix potential memory leak in hs_helper_build_hs_desc_impl().



commit dc2384da30cae716f512dedef37d27f00c43f29d
Author: Alexander Færøy <ahf@xxxxxxxxxxxxxx>
Date:   Sat Jun 23 10:27:10 2018 +0200

    Fix potential memory leak in hs_helper_build_hs_desc_impl().
    
    This patch fixes a memory leak in hs_helper_build_hs_desc_impl() where
    if a test assertion would fail we would leak the storage that `desc`
    points to.
    
    See: Coverity CID 1437448
---
 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 f7e054b1d..dcd58bc5f 100644
--- a/src/test/hs_test_helpers.c
+++ b/src/test/hs_test_helpers.c
@@ -142,6 +142,9 @@ hs_helper_build_hs_desc_impl(unsigned int no_ip,
 
   descp = desc;
  done:
+  if (descp == NULL)
+    tor_free(desc);
+
   return descp;
 }
 



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