Fix memory leak in digestmd5 patches
Signed-off-by: Simo Sorce <simo@redhat.com>
This commit is contained in:
parent
b96caf4432
commit
a64513daf1
@ -105,7 +105,7 @@ diff -uPr cyrus-sasl-2.1.27/plugins/digestmd5.c cyrus-sasl-2.1.27.digestmd5/plug
|
||||
|
||||
/* setup dec context */
|
||||
c++;
|
||||
@@ -1102,60 +1114,139 @@
|
||||
@@ -1102,60 +1114,143 @@
|
||||
|
||||
memcpy(c->ivec, ((char *) deckey) + 8, 8);
|
||||
|
||||
@ -204,13 +204,13 @@ diff -uPr cyrus-sasl-2.1.27/plugins/digestmd5.c cyrus-sasl-2.1.27.digestmd5/plug
|
||||
unsigned char enckey[16],
|
||||
unsigned char deckey[16])
|
||||
{
|
||||
+ const EVP_CIPHER *cipher;
|
||||
EVP_CIPHER_CTX *ctx;
|
||||
int rc;
|
||||
|
||||
- ctx = EVP_CIPHER_CTX_new();
|
||||
- if (ctx == NULL) return SASL_NOMEM;
|
||||
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
+ EVP_CIPHER *cipher;
|
||||
+ ossl3_context_t *ossl3_ctx;
|
||||
|
||||
- rc = EVP_EncryptInit_ex(ctx, EVP_rc4(), NULL, enckey, NULL);
|
||||
@ -221,6 +221,7 @@ diff -uPr cyrus-sasl-2.1.27/plugins/digestmd5.c cyrus-sasl-2.1.27.digestmd5/plug
|
||||
+ ossl3_ctx = (ossl3_context_t *)text->crypto.libctx;
|
||||
+ cipher = EVP_CIPHER_fetch(ossl3_ctx->libctx, "RC4", "");
|
||||
+#else
|
||||
+ const EVP_CIPHER *cipher;
|
||||
+ cipher = EVP_rc4();
|
||||
+#endif
|
||||
|
||||
@ -260,6 +261,9 @@ diff -uPr cyrus-sasl-2.1.27/plugins/digestmd5.c cyrus-sasl-2.1.27.digestmd5/plug
|
||||
+ rc = SASL_OK;
|
||||
+
|
||||
+done:
|
||||
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
+ EVP_CIPHER_free(cipher);
|
||||
+#endif
|
||||
+ if (rc != SASL_OK) {
|
||||
+ free_rc4(text);
|
||||
+ }
|
||||
|
Loading…
Reference in New Issue
Block a user