mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 12:11:27 -05:00 
			
		
		
		
	Avoid memory leak with repeated [gc]ccm_setkey()
This commit is contained in:
		
							parent
							
								
									3a89559d71
								
							
						
					
					
						commit
						43b08574a6
					
				@ -81,6 +81,8 @@ int mbedtls_ccm_setkey( mbedtls_ccm_context *ctx,
 | 
			
		||||
    if( cipher_info->block_size != 16 )
 | 
			
		||||
        return( MBEDTLS_ERR_CCM_BAD_INPUT );
 | 
			
		||||
 | 
			
		||||
    mbedtls_cipher_free( &ctx->cipher_ctx );
 | 
			
		||||
 | 
			
		||||
    if( ( ret = mbedtls_cipher_setup( &ctx->cipher_ctx, cipher_info ) ) != 0 )
 | 
			
		||||
        return( ret );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -174,6 +174,8 @@ int mbedtls_gcm_setkey( mbedtls_gcm_context *ctx,
 | 
			
		||||
    if( cipher_info->block_size != 16 )
 | 
			
		||||
        return( MBEDTLS_ERR_GCM_BAD_INPUT );
 | 
			
		||||
 | 
			
		||||
    mbedtls_cipher_free( &ctx->cipher_ctx );
 | 
			
		||||
 | 
			
		||||
    if( ( ret = mbedtls_cipher_setup( &ctx->cipher_ctx, cipher_info ) ) != 0 )
 | 
			
		||||
        return( ret );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user