@@ -1952,6 +1952,7 @@ zend_result phar_create_signature(phar_archive_data *phar, php_stream *fp, char
1952
1952
1953
1953
if (!EVP_SignInit (md_ctx , mdtype )) {
1954
1954
EVP_PKEY_free (key );
1955
+ EVP_MD_CTX_free (md_ctx );
1955
1956
efree (sigbuf );
1956
1957
if (error ) {
1957
1958
spprintf (error , 0 , "unable to initialize openssl signature for phar \"%s\"" , phar -> fname );
@@ -1962,6 +1963,7 @@ zend_result phar_create_signature(phar_archive_data *phar, php_stream *fp, char
1962
1963
while ((sig_len = php_stream_read (fp , (char * )buf , sizeof (buf ))) > 0 ) {
1963
1964
if (!EVP_SignUpdate (md_ctx , buf , sig_len )) {
1964
1965
EVP_PKEY_free (key );
1966
+ EVP_MD_CTX_free (md_ctx );
1965
1967
efree (sigbuf );
1966
1968
if (error ) {
1967
1969
spprintf (error , 0 , "unable to update the openssl signature for phar \"%s\"" , phar -> fname );
@@ -1972,6 +1974,7 @@ zend_result phar_create_signature(phar_archive_data *phar, php_stream *fp, char
1972
1974
1973
1975
if (!EVP_SignFinal (md_ctx , sigbuf , & siglen , key )) {
1974
1976
EVP_PKEY_free (key );
1977
+ EVP_MD_CTX_free (md_ctx );
1975
1978
efree (sigbuf );
1976
1979
if (error ) {
1977
1980
spprintf (error , 0 , "unable to write phar \"%s\" with requested openssl signature" , phar -> fname );
@@ -1981,7 +1984,7 @@ zend_result phar_create_signature(phar_archive_data *phar, php_stream *fp, char
1981
1984
1982
1985
sigbuf [siglen ] = '\0' ;
1983
1986
EVP_PKEY_free (key );
1984
- EVP_MD_CTX_destroy (md_ctx );
1987
+ EVP_MD_CTX_free (md_ctx );
1985
1988
#else
1986
1989
size_t siglen ;
1987
1990
sigbuf = NULL ;
0 commit comments