-fix leak
authorChristian Grothoff <christian@grothoff.org>
Thu, 5 Dec 2013 21:30:58 +0000 (21:30 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 5 Dec 2013 21:30:58 +0000 (21:30 +0000)
src/secretsharing/gnunet-service-secretsharing.c

index c7b1f2d0d8534fd791e27ae780cd67aa769a60a2..e9417080eaeed676a686a2695204c5bd90f9d46d 100644 (file)
@@ -236,7 +236,7 @@ hash_cmp (const void *h1, const void *h2)
 /**
  * Normalize the given list of peers, by including the local peer
  * (if it is missing) and sorting the peers by their identity.
- * 
+ *
  * @param listed peers in the unnormalized list
  * @param num_listed peers in the un-normalized list
  * @param num_normalized[out] number of peers in the normalized list
@@ -309,7 +309,7 @@ paillier_create (unsigned int s, gcry_mpi_t n, gcry_mpi_t g, gcry_mpi_t lambda,
 
   GNUNET_assert (0 != (phi = gcry_mpi_new (PAILLIER_BITS)));
   GNUNET_assert (0 != (tmp = gcry_mpi_new (PAILLIER_BITS)));
+
   // generate rsa modulus
   GNUNET_assert (0 == gcry_prime_generate (&p, s, 0, NULL, NULL, NULL,
                                            GCRY_WEAK_RANDOM, 0));
@@ -342,7 +342,7 @@ paillier_encrypt (gcry_mpi_t c, gcry_mpi_t m, gcry_mpi_t g, gcry_mpi_t n)
   GNUNET_assert (0 != (r = gcry_mpi_new (0)));
 
   gcry_mpi_mul (n_square, n, n);
-  
+
   // generate r < n
   do
   {
@@ -496,10 +496,10 @@ insert_round2_element (struct KeygenSession *ks)
   }
 
   GNUNET_CONSENSUS_insert (ks->consensus, element, NULL, NULL);
+  GNUNET_free (element); /* FIXME: maybe stack-allocate instead? */
 }
 
 
-
 static void
 keygen_round1_conclude (void *cls)
 {
@@ -589,7 +589,7 @@ static void handle_client_keygen (void *cls,
   generate_presecret_polynomial (ks);
 
   insert_round1_element (ks);
-  
+
   GNUNET_CONSENSUS_conclude (ks->consensus, GNUNET_TIME_UNIT_FOREVER_REL /* FIXME */, keygen_round1_conclude, ks);
 }