[tor-commits] [tor/release-0.3.2] Fix potential memory leak in hs_helper_build_hs_desc_impl().

nickm at torproject.org nickm at torproject.org
Fri Jun 29 17:06:30 UTC 2018


commit dc2384da30cae716f512dedef37d27f00c43f29d
Author: Alexander Færøy <ahf at torproject.org>
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;
 }
 





More information about the tor-commits mailing list