fixing resource leaks
[oweals/gnunet.git] / src / ats / gnunet-ats-solver-eval.c
index 7eb1638df75a491a452338f25f40e4f8a1b80b36..412ed47d646fcd869b678418d4bc00f6db5022b2 100644 (file)
@@ -374,17 +374,20 @@ GNUNET_ATS_solver_generate_property_stop (struct PropertyGenerator *pg)
 
 
 /**
- * Generate between the source master and the partner and set preferences with a
+ * Generate between the source master and the partner and set property with a
  * value depending on the generator.
  *
- * @param src source
- * @param dest partner
- * @param type type of preferences to generate
- * @param base_rate traffic base rate to send data with
- * @param max_rate  traffic maximum rate to send data with
- * @param period duration of a period of traffic generation (~ 1/frequency)
- * @param duration how long to generate traffic
- * @return the traffic generator
+ * @param peer source
+ * @param address_id partner
+ * @param test_peer the peer
+ * @param test_address the address
+ * @param type type of generator
+ * @param base_value base value
+ * @param value_rate maximum value
+ * @param period duration of a period of generation (~ 1/frequency)
+ * @param frequency how long to generate property
+ * @param ats_property ATS property to generate
+ * @return the property generator
  */
 struct PropertyGenerator *
 GNUNET_ATS_solver_generate_property_start (unsigned int peer,
@@ -614,17 +617,19 @@ GNUNET_ATS_solver_generate_preferences_stop (struct PreferenceGenerator *pg)
 
 
 /**
- * Generate between the source master and the partner and set preferences with a
+ * Generate between the source master and the partner and set property with a
  * value depending on the generator.
  *
- * @param src source
- * @param dest partner
- * @param type type of preferences to generate
- * @param base_rate traffic base rate to send data with
- * @param max_rate  traffic maximum rate to send data with
- * @param period duration of a period of traffic generation (~ 1/frequency)
- * @param duration how long to generate traffic
- * @return the traffic generator
+ * @param peer source
+ * @param address_id partner
+ * @param client_id the client
+ * @param type type of generator
+ * @param base_value base value
+ * @param value_rate maximum value
+ * @param period duration of a period of generation (~ 1/frequency)
+ * @param frequency how long to generate property
+ * @param kind ATS preference to generate
+ * @return the preference generator
  */
 struct PreferenceGenerator *
 GNUNET_ATS_solver_generate_preferences_start (unsigned int peer,
@@ -1417,7 +1422,6 @@ load_op_stop_set_property (struct GNUNET_ATS_TEST_Operation *o,
       fprintf (stderr, "Invalid property in operation %u `%s' in episode %u\n",
           op_counter, op_name, e->id);
       GNUNET_free (op_name);
-      GNUNET_free (pref);
       GNUNET_free_non_null (pref);
       return GNUNET_SYSERR;
   }
@@ -1688,10 +1692,11 @@ enforce_add_address (struct GNUNET_ATS_TEST_Operation *op)
     GNUNET_CONTAINER_DLL_insert (peer_head, peer_tail, p);
   }
 
-  if (NULL != (a = find_address_by_id (p, op->address_id)))
+  if (NULL != (find_address_by_id (p, op->address_id)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Duplicate address %u for peer %u\n",
         op->address_id, op->peer_id);
+    return;
   }
 
   a = GNUNET_new (struct TestAddress);
@@ -1716,7 +1721,6 @@ static void
 enforce_del_address (struct GNUNET_ATS_TEST_Operation *op)
 {
   struct TestPeer *p;
-  struct TestAddress *a;
   struct AddressLookupCtx ctx;
 
   if (NULL == (p = find_peer_by_id (op->peer_id)))
@@ -1740,7 +1744,7 @@ enforce_del_address (struct GNUNET_ATS_TEST_Operation *op)
     return;
   }
 
-  if (NULL == (a = find_address_by_id (p, op->address_id)))
+  if (NULL == (find_address_by_id (p, op->address_id)))
   {
     GNUNET_break (0);
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1811,14 +1815,13 @@ static void
 enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op)
 {
   struct PreferenceGenerator *pg;
-  struct TestPeer *p;
   if (NULL != (pg = find_pref_gen (op->peer_id, op->address_id, op->pref_type)))
   {
     GNUNET_ATS_solver_generate_preferences_stop (pg);
     GNUNET_free (pg);
   }
 
-  if (NULL == (p = find_peer_by_id (op->peer_id)))
+  if (NULL == (find_peer_by_id (op->peer_id)))
   {
     GNUNET_break (0);
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -2128,7 +2131,8 @@ free_all_it (void *cls,
     void *value)
 {
   struct ATS_Address *address = value;
-  GNUNET_CONTAINER_multipeermap_remove (sh->env.addresses, key, value);
+  GNUNET_break (GNUNET_OK != GNUNET_CONTAINER_multipeermap_remove (sh->env.addresses,
+      key, value));
   GNUNET_free (address);
 
   return GNUNET_OK;
@@ -2253,6 +2257,7 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
 /**
  * Information callback for the solver
  *
+ * @param cls the closure
  * @param op the solver operation
  * @param stat status of the solver operation
  * @param add additional solver information