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
This commit is contained in:
Alexander Færøy 2018-06-23 10:27:10 +02:00
parent 8c8941eb29
commit dc2384da30

View File

@ -142,6 +142,9 @@ hs_helper_build_hs_desc_impl(unsigned int no_ip,
descp = desc; descp = desc;
done: done:
if (descp == NULL)
tor_free(desc);
return descp; return descp;
} }