소스 검색

last leaks removed

Carlos Aguilar 8 년 전
부모
커밋
44bf2537e3
2개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 2 0
      crypto/NFLlib.cpp
  2. 7 7
      pir/queryGen/PIRQueryGenerator_internal.cpp

+ 2 - 0
crypto/NFLlib.cpp

@@ -584,6 +584,7 @@ void NFLlib::freeNTTMemory(){
   
     if (i == alreadyInit - 1)
     {
+      free(phis);
       free(shoupphis);
       free(invpoly_times_invphis);
       free(shoupinvpoly_times_invphis);
@@ -595,6 +596,7 @@ void NFLlib::freeNTTMemory(){
       delete[] liftingIntegers;
       free(inv_indexes);
       mpz_clear(moduliProduct);
+      delete[] moduli;
     }
   }
 

+ 7 - 7
pir/queryGen/PIRQueryGenerator_internal.cpp

@@ -50,6 +50,7 @@ void PIRQueryGenerator_internal::generateQuery()
   std::cout << "PIRQueryGenerator_internal: Generated a " << pirParams.n[j] << " element query" << std::endl;
   }
   double end = omp_get_wtime();
+  delete[] coord;
   
   std::cout << "PIRQueryGenerator_internal: All the queries have been generated, total time is " << end - start << " seconds" << std::endl;
 }
@@ -99,16 +100,15 @@ void PIRQueryGenerator_internal::joinThread()
 	if(queryThread.joinable()) queryThread.join();
 }
 
+void PIRQueryGenerator_internal::cleanQueryBuffer()
+{
+	while (!queryBuffer.empty())
+		free(queryBuffer.pop_front());
+}
+
 PIRQueryGenerator_internal::~PIRQueryGenerator_internal() 
 {
 	joinThread();
   cleanQueryBuffer();
-
-	delete[] coord;
 }
 
-void PIRQueryGenerator_internal::cleanQueryBuffer()
-{
-	while (!queryBuffer.empty())
-		free(queryBuffer.pop_front());
-}