@@ -1952,6 +1952,7 @@ zend_result phar_create_signature(phar_archive_data *phar, php_stream *fp, char
19521952
19531953 if (!EVP_SignInit (md_ctx , mdtype )) {
19541954 EVP_PKEY_free (key );
1955+ EVP_MD_CTX_free (md_ctx );
19551956 efree (sigbuf );
19561957 if (error ) {
19571958 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
19621963 while ((sig_len = php_stream_read (fp , (char * )buf , sizeof (buf ))) > 0 ) {
19631964 if (!EVP_SignUpdate (md_ctx , buf , sig_len )) {
19641965 EVP_PKEY_free (key );
1966+ EVP_MD_CTX_free (md_ctx );
19651967 efree (sigbuf );
19661968 if (error ) {
19671969 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
19721974
19731975 if (!EVP_SignFinal (md_ctx , sigbuf , & siglen , key )) {
19741976 EVP_PKEY_free (key );
1977+ EVP_MD_CTX_free (md_ctx );
19751978 efree (sigbuf );
19761979 if (error ) {
19771980 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
19811984
19821985 sigbuf [siglen ] = '\0' ;
19831986 EVP_PKEY_free (key );
1984- EVP_MD_CTX_destroy (md_ctx );
1987+ EVP_MD_CTX_free (md_ctx );
19851988#else
19861989 size_t siglen ;
19871990 sigbuf = NULL ;
0 commit comments