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:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user