@@ -1921,6 +1921,7 @@ zend_result phar_create_signature(phar_archive_data *phar, php_stream *fp, char
19211921
19221922 if (!EVP_SignInit (md_ctx , mdtype )) {
19231923 EVP_PKEY_free (key );
1924+ EVP_MD_CTX_free (md_ctx );
19241925 efree (sigbuf );
19251926 if (error ) {
19261927 spprintf (error , 0 , "unable to initialize openssl signature for phar \"%s\"" , phar -> fname );
@@ -1931,6 +1932,7 @@ zend_result phar_create_signature(phar_archive_data *phar, php_stream *fp, char
19311932 while ((sig_len = php_stream_read (fp , (char * )buf , sizeof (buf ))) > 0 ) {
19321933 if (!EVP_SignUpdate (md_ctx , buf , sig_len )) {
19331934 EVP_PKEY_free (key );
1935+ EVP_MD_CTX_free (md_ctx );
19341936 efree (sigbuf );
19351937 if (error ) {
19361938 spprintf (error , 0 , "unable to update the openssl signature for phar \"%s\"" , phar -> fname );
@@ -1941,6 +1943,7 @@ zend_result phar_create_signature(phar_archive_data *phar, php_stream *fp, char
19411943
19421944 if (!EVP_SignFinal (md_ctx , sigbuf , & siglen , key )) {
19431945 EVP_PKEY_free (key );
1946+ EVP_MD_CTX_free (md_ctx );
19441947 efree (sigbuf );
19451948 if (error ) {
19461949 spprintf (error , 0 , "unable to write phar \"%s\" with requested openssl signature" , phar -> fname );
@@ -1950,7 +1953,7 @@ zend_result phar_create_signature(phar_archive_data *phar, php_stream *fp, char
19501953
19511954 sigbuf [siglen ] = '\0' ;
19521955 EVP_PKEY_free (key );
1953- EVP_MD_CTX_destroy (md_ctx );
1956+ EVP_MD_CTX_free (md_ctx );
19541957#else
19551958 size_t siglen ;
19561959 sigbuf = NULL ;
0 commit comments