Skip to content

Commit 74ee3ba

Browse files
committed
Use EVP_MD_CTX_destroy() instead of EVP_MD_CTX_free() for compatibility and consistency
1 parent 22aaa20 commit 74ee3ba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/phar/util.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,7 +1905,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat
19051905

19061906
if (!EVP_SignInit(md_ctx, mdtype)) {
19071907
EVP_PKEY_free(key);
1908-
EVP_MD_CTX_free(md_ctx);
1908+
EVP_MD_CTX_destroy(md_ctx);
19091909
efree(sigbuf);
19101910
if (error) {
19111911
spprintf(error, 0, "unable to initialize openssl signature for phar \"%s\"", phar->fname);
@@ -1916,7 +1916,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat
19161916
while ((sig_len = php_stream_read(fp, (char*)buf, sizeof(buf))) > 0) {
19171917
if (!EVP_SignUpdate(md_ctx, buf, sig_len)) {
19181918
EVP_PKEY_free(key);
1919-
EVP_MD_CTX_free(md_ctx);
1919+
EVP_MD_CTX_destroy(md_ctx);
19201920
efree(sigbuf);
19211921
if (error) {
19221922
spprintf(error, 0, "unable to update the openssl signature for phar \"%s\"", phar->fname);
@@ -1927,7 +1927,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat
19271927

19281928
if (!EVP_SignFinal (md_ctx, sigbuf, &siglen, key)) {
19291929
EVP_PKEY_free(key);
1930-
EVP_MD_CTX_free(md_ctx);
1930+
EVP_MD_CTX_destroy(md_ctx);
19311931
efree(sigbuf);
19321932
if (error) {
19331933
spprintf(error, 0, "unable to write phar \"%s\" with requested openssl signature", phar->fname);
@@ -1937,7 +1937,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat
19371937

19381938
sigbuf[siglen] = '\0';
19391939
EVP_PKEY_free(key);
1940-
EVP_MD_CTX_free(md_ctx);
1940+
EVP_MD_CTX_destroy(md_ctx);
19411941
#else
19421942
size_t siglen;
19431943
sigbuf = NULL;

0 commit comments

Comments
 (0)