From dc2384da30cae716f512dedef37d27f00c43f29d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20F=C3=A6r=C3=B8y?= Date: Sat, 23 Jun 2018 10:27:10 +0200 Subject: [PATCH] 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 f7e054b1d1..dcd58bc5fd 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; }