Browse Source

last leaks removed

Carlos Aguilar 6 years ago
parent
commit
44bf2537e3
2 changed files with 9 additions and 7 deletions
  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());
-}