Fix leak in cipherBlockNew().
The string used to look up the cipher type was leaked.
@@ -399,10 +399,13 @@ cipherBlockNew(CipherMode mode, CipherType cipherType, const Buffer *pass, const
// Lookup cipher by name. This means the ciphers passed in must exactly match a name expected by OpenSSL. This is a good
// thing since the name required by the openssl command-line tool will match what is used by pgBackRest.
- const EVP_CIPHER *cipher = EVP_get_cipherbyname(strZ(strIdToStr(cipherType)));
+ String *const cipherTypeStr = strIdToStr(cipherType);
+ const EVP_CIPHER *cipher = EVP_get_cipherbyname(strZ(cipherTypeStr));
if (!cipher)
- THROW_FMT(AssertError, "unable to load cipher '%s'", strZ(strIdToStr(cipherType)));
+ THROW_FMT(AssertError, "unable to load cipher '%s'", strZ(cipherTypeStr));
+
+ strFree(cipherTypeStr);
// Lookup digest. If not defined it will be set to sha1.
const EVP_MD *digest = NULL;
