1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Fix memory leaks in openssl_pkcs7_encrypt() when push fails

This commit is contained in:
ndossche
2026-01-20 15:20:11 +01:00
committed by ndossche
parent ef54becb3e
commit 556ec77951

View File

@@ -5849,7 +5849,10 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
goto clean_exit;
}
}
sk_X509_push(recipcerts, cert);
if (sk_X509_push(recipcerts, cert) <= 0) {
X509_free(cert);
goto clean_exit;
}
} ZEND_HASH_FOREACH_END();
} else {
/* a single certificate */
@@ -5870,7 +5873,10 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
goto clean_exit;
}
}
sk_X509_push(recipcerts, cert);
if (sk_X509_push(recipcerts, cert) <= 0) {
X509_free(cert);
goto clean_exit;
}
}
/* sanity check the cipher */