]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
wolfSSL/CyaSSL: Fix memory leak in Curl_cyassl_random
authorCarie Pointer <carie@wolfssl.com>
Fri, 20 Jul 2018 20:00:09 +0000 (13:00 -0700)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 26 Jul 2018 14:21:59 +0000 (16:21 +0200)
RNG structure must be freed by call to FreeRng after its use in
Curl_cyassl_random. This call fixes Valgrind failures when running the
test suite with wolfSSL.

Closes #2784

lib/vtls/cyassl.c

index 0e940487a07d2bb4ad02daeeb3fb4f319e9fd145..e10398ac3f762ca2388945a9c06cd182a0459f00 100644 (file)
@@ -968,6 +968,8 @@ static CURLcode Curl_cyassl_random(struct Curl_easy *data,
     return CURLE_FAILED_INIT;
   if(RNG_GenerateBlock(&rng, entropy, (unsigned)length))
     return CURLE_FAILED_INIT;
+  if(FreeRng(&rng))
+    return CURLE_FAILED_INIT;
   return CURLE_OK;
 }