Просмотр исходного кода

mbedtls: Fix memory leak in initial ECDH exchange if OOM/failure occurs

In ecp_mul_comb(), if (!p_eq_g && grp->T == NULL) and ecp_precompute_comb() fails (which can happen due to OOM), then the new array of points T was leaked.
Angus Gratton 8 лет назад
Родитель
Сommit
ffefeef5ea
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      components/mbedtls/library/ecp.c

+ 1 - 1
components/mbedtls/library/ecp.c

@@ -1406,7 +1406,7 @@ static int ecp_mul_comb( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
 
 cleanup:
 
-    if( T != NULL && ! p_eq_g )
+    if( T != NULL && T != grp->T )
     {
         for( i = 0; i < pre_len; i++ )
             mbedtls_ecp_point_free( &T[i] );