]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix potential memory leak in hs_helper_build_hs_desc_impl().
authorAlexander Færøy <ahf@torproject.org>
Sat, 23 Jun 2018 08:27:10 +0000 (10:27 +0200)
committerAlexander Færøy <ahf@torproject.org>
Sat, 23 Jun 2018 08:27:10 +0000 (10:27 +0200)
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

index f7e054b1d1a07e7347eca186d177cd317efdcc26..dcd58bc5fdbe6f72b4453935ecca0794f0d88c8e 100644 (file)
@@ -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;
 }