@@ -386,7 +386,7 @@ static void php_hash_do_hash(
386386 }
387387 php_stream_close (stream );
388388 if (n < 0 ) {
389- efree ( context );
389+ php_hash_free_context ( ops , context );
390390 RETURN_FALSE ;
391391 }
392392 } else {
@@ -395,7 +395,7 @@ static void php_hash_do_hash(
395395
396396 digest = zend_string_alloc (ops -> digest_size , 0 );
397397 ops -> hash_final ((unsigned char * ) ZSTR_VAL (digest ), context );
398- efree ( context );
398+ php_hash_free_context ( ops , context );
399399
400400 if (raw_output ) {
401401 ZSTR_VAL (digest )[ops -> digest_size ] = 0 ;
@@ -534,7 +534,7 @@ static void php_hash_do_hash_hmac(
534534 }
535535 php_stream_close (stream );
536536 if (n < 0 ) {
537- efree ( context );
537+ php_hash_free_context ( ops , context );
538538 efree (K );
539539 zend_string_efree (digest );
540540 RETURN_FALSE ;
@@ -552,7 +552,7 @@ static void php_hash_do_hash_hmac(
552552 /* Zero the key */
553553 ZEND_SECURE_ZERO (K , ops -> block_size );
554554 efree (K );
555- efree ( context );
555+ php_hash_free_context ( ops , context );
556556
557557 if (raw_output ) {
558558 ZSTR_VAL (digest )[ops -> digest_size ] = 0 ;
@@ -813,7 +813,7 @@ PHP_FUNCTION(hash_final)
813813 ZSTR_VAL (digest )[digest_len ] = 0 ;
814814
815815 /* Invalidate the object from further use */
816- efree ( hash -> context );
816+ php_hash_free_context ( hash -> ops , hash -> context );
817817 hash -> context = NULL ;
818818
819819 if (raw_output ) {
@@ -967,7 +967,7 @@ PHP_FUNCTION(hash_hkdf)
967967 ZEND_SECURE_ZERO (digest , ops -> digest_size );
968968 ZEND_SECURE_ZERO (prk , ops -> digest_size );
969969 efree (K );
970- efree ( context );
970+ php_hash_free_context ( ops , context );
971971 efree (prk );
972972 efree (digest );
973973 ZSTR_VAL (returnval )[length ] = 0 ;
@@ -1083,7 +1083,7 @@ PHP_FUNCTION(hash_pbkdf2)
10831083 efree (K1 );
10841084 efree (K2 );
10851085 efree (computed_salt );
1086- efree ( context );
1086+ php_hash_free_context ( ops , context );
10871087 efree (digest );
10881088 efree (temp );
10891089
@@ -1348,7 +1348,7 @@ PHP_FUNCTION(mhash_keygen_s2k)
13481348 RETVAL_STRINGL (key , bytes );
13491349 ZEND_SECURE_ZERO (key , bytes );
13501350 efree (digest );
1351- efree ( context );
1351+ php_hash_free_context ( ops , context );
13521352 efree (key );
13531353 }
13541354 }
@@ -1378,7 +1378,7 @@ static void php_hashcontext_dtor(zend_object *obj) {
13781378 php_hashcontext_object * hash = php_hashcontext_from_object (obj );
13791379
13801380 if (hash -> context ) {
1381- efree ( hash -> context );
1381+ php_hash_free_context ( hash -> ops , hash -> context );
13821382 hash -> context = NULL ;
13831383 }
13841384
@@ -1414,7 +1414,7 @@ static zend_object *php_hashcontext_clone(zend_object *zobj) {
14141414 newobj -> ops -> hash_init (newobj -> context , NULL );
14151415
14161416 if (SUCCESS != newobj -> ops -> hash_copy (newobj -> ops , oldobj -> context , newobj -> context )) {
1417- efree ( newobj -> context );
1417+ php_hash_free_context ( newobj -> ops , newobj -> context );
14181418 newobj -> context = NULL ;
14191419 return znew ;
14201420 }
0 commit comments