diff --git a/lib/base/tlsutility.cpp b/lib/base/tlsutility.cpp index 0748391b1..d34e465c9 100644 --- a/lib/base/tlsutility.cpp +++ b/lib/base/tlsutility.cpp @@ -561,6 +561,7 @@ String RandomString(int length) sprintf(output + 2 * i, "%02x", bytes[i]); String result = output; + delete [] bytes; delete [] output; return result; diff --git a/lib/remote/base64.cpp b/lib/remote/base64.cpp index 3f0a587d7..74ed58380 100644 --- a/lib/remote/base64.cpp +++ b/lib/remote/base64.cpp @@ -39,7 +39,7 @@ String Base64::Encode(const String& input) String ret = String(outbuf, outbuf + len); BIO_free_all(bio64); - + return ret; } @@ -61,7 +61,8 @@ String Base64::Decode(const String& input) String ret = String(outbuf, outbuf + len); BIO_free_all(bio64); - + delete [] outbuf; + if (ret.IsEmpty() && !input.IsEmpty()) throw std::invalid_argument("Not a valid base64 string");