瀏覽代碼

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
Alexander Færøy 6 年之前
父節點
當前提交
dc2384da30
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/test/hs_test_helpers.c

+ 3 - 0
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;
 }